I have tried this, but it won't work. PHP: $this->getServer()->getCommandMap()->getCommand('ban')->unregister($this->getServer()->getCommandMap()); Is it possible to unregister a default command without changing the PMMP source code? Plz help, thanks.
This is how I do it on my server... PHP: //onEnable()$unregister = array("help", "version", "teleport"); //unregistering... note that the command wont be unregistered until overrided.foreach ($unregister as $cmd) { if ($this->getServer()->getCommandMap()->getCommand($cmd) !== null) { $this->getServer()->getCommandMap()->getCommand($cmd)->setLabel($cmd.'__');//hacky? $this->getServer()->getCommandMap()->getCommand($cmd)->unregister($this->getServer()->getCommandMap()); }}//Overriding... (onEnable())$this->getServer()->getCommandMap()->register("help", new HelpCommand($this));$this->getServer()->getCommandMap()->register("version", new VersionCommand($this));$this->getServer()->getCommandMap()->register("teleport", new TeleportCommand($this));//Separate class.//HelpCommand classpublic function __construct(MainClass $plugin, $cmd){ parent::__construct($cmd, "For noobs", null, ["?"]); //"For noobs" => description, ["?"] => array of aliases. $this->plugin = $plugin;}public function execute(CommandSender $issuer, $alias, array $args){ if(!$this->testPermission($issuer)) return true; $issuer->sendMessage("modified help command output."); return true;}
There is an easier method! Edit the pocketmine.yml and create a new alias without command. Code: aliases: me: If that doesn't work anymore you can blame @dktapps . Spoiler: where did i say that before... https://forums.pocketmine.net/threads/remove-some-commands.18018/#post-170950
How to delete a default command ? I'm using that but commands which aren't modified always work... Help?