owningPlugin = $owner; $this->executor = $executor; $this->usageMessage = ""; } public function execute(CommandSender $sender, string $commandLabel, array $args){ if(!$this->owningPlugin->isEnabled()){ return false; } if(!$this->testPermission($sender)){ return false; } $success = $this->executor->onCommand($sender, $this, $commandLabel, $args); if(!$success and $this->usageMessage !== ""){ throw new InvalidCommandSyntaxException(); } return $success; } public function getExecutor() : CommandExecutor{ return $this->executor; } public function setExecutor(CommandExecutor $executor) : void{ $this->executor = $executor; } }