First I'd like to say hello all! It's been quite a while since I've been here. Anyway, to the point: I'm trying to register a couple of commands in my plugin's onEnable() method, with this function I made: PHP: private function registerCommand($cmd, $usage, $desc, $perm, $permMsg, CommandExecutor $executor){ $command = new PluginCommand($cmd); $command->setUsage($usage); $command->setDescription($desc); $command->setPermission($perm); $command->setPermissionMessage($permMsg); $command->setExecutor($executor); $this->getServer()->getCommandMap()->register($fallbackPrefix, $command); } I get the $command parameter, but I don't know what a fallback prefix is. So I have 3 questions: What is it, and what do I supply for it? Also, how can I make the command op by default from there? I assumed setPermissionMessage() was for that, but I realize it's probably equivalent to setting 'description' in plugin.yml
Permission message is equivalent to 'permission-message' in plugin.yml. To answer your question 1: Fallback prefix is a method for players to use your command if another plugin also registered that command. The fallback prefix of PocketMine commands is "pocketmine". Say, if there is a plugin that registers a command "gc" (same to /gc in PocketMine as for garbage collection debug command) with the fallback prefix as "myplugin" (fallback prefixes are usually the plugin name), it is undefined which command would be executed if a player uses /gc, but /pocketmine:gc would become that for garbage collection and /myplugin:gc will be the plugin one. For 2: You have to register permission $perm. If you want to register it in plugin.yml, do it the normal way with "default" attribute as "op". If you want to register it dynamically, take a look at SimpleWarp.
Well said! Makes perfect sense. Also I figured out the permission part, I had to use this code and then use $cmd->setPermission() afterwards: PHP: $perm = new Permission($permName);$perm->setDescription($permDesc);$perm->setDefault($permDefault); edit: indentation