PocketMine-MP already has one. You should update your plugin from the old API to the new one. Spoiler You may show us the console?
Here's an example \PocketMine\plugins\PluginName\plugin.yml PHP: name: PluginNameversion: 1.0.0api: [2.0.0]main: AuthorName\PluginName\Mainauthor: Survingopermissions:pluginname.command.info: description: "Allows using command" default: true \PocketMine\plugins\PluginName\src\AuthorName\PluginName\Main.php PHP: <?phpnamespace AuthorName\PluginName;use pocketmine\plugin\PluginBase;class Main extends PluginBase { public function onEnable(){ $this->getServer()->getLogger()->info("Plugin enabled!");$this->getServer()->getCommandMap()->register("command-name", new CommandNameClass($this)); }} \PocketMine\plugins\PluginName\src\AuthorName\PluginName\CommandNameClass.php PHP: <?phpnamespace AuthorName\PluginName;use pocketmine\command\Command;use pocketmine\command\CommandSender;class CommandNameClass extends Command implements \pocketmine\command\PluginIdentifiableCommand { /** @var Main $plugin */ private $plugin; public function __construct(Main $plugin){ parent::__construct("command-name", "description", null, ["aliases"]); $this->plugin = $plugin; $this->setPermission("pluginname.command.info"); } public function execute(CommandSender $sender, $currentAlias, array $args){ // will be done by running the commandforeach($this->plugin->getServer()->getOnlinePlayers() as $player){$player->sendMessage("hi");}}}
Ah, I think I got it. I forgot getPlugin() function in CommandNameClass because of the PluginIdentifiableCommand Here's source code if you want it to run and edit it, just extract it in your plugins folder
You should make a space at plugin.yml before plugin.opme: And class MainBase extends PluginBase{ remember in plugin.yml the main: name and also remember in your OP.php Command the aliases. If someone would run the command aliases he would run opme
So you are asking for PocketMine API code and then you try to do it with another software because its buggy. ok
You don't use multiple classes for commands for no reason. The onCommand() function in the main class is good enough unless you have like hundreds of lines of code to manage, or if you need some hierarchical relationship between different commands.