Hello, I may have asked this a few weeks ago but I want to ask for help again. I'm creating a simple plugin and I put in the commands in my plugin.yml Code: commands: info: description: "Shows information about the server" usage: "/info" permission: myplugin.example quit: description: "Kicks player from server" usage: "/quit" permission: player.kick inv: description: "Lists all items in Player Iv" usage: "/inv" permission: inventory.BaseInventory And I need help. For the permission I don't know what it means. For the info I need it to show text to just one user For the quit I need it to kick the player that executed the command And the Inv I want it to display what is in the users inventory. Also I'm making the plugin on GitHub so you can access it here. Thanks for your help in advance.
Indent your plugin.yml correctly, or it won't work. As for permissions, please read about the documentation for permission nodes.
Code: commands: info: description: "Shows information about the server" usage: "/info" permission: pluginName.info quit: description: "Kicks player from server" usage: "/quit" permission: pluginName.kick inv: description: "Lists all items in Player Inventory" usage: "/inv" permission: pluginName.BaseInventory
Have the command section of the plugin.yml file like what @HotFireyDeath said. Then make the permission section something like this: PHP: permissions: example: default: false (false if you want nobody to use it) description: This one will give the user to use all of the permissions children: example.command: default: false description: This one will let the user use all of the commands children: example.command.info: default: true (true if you want everyone to use it) description: Allows the player to run the info command example.command.quit: default: op (op if you only want ops to use it) description: Allows the player to run the quit command example.command.inv: default: op description: Allows the player to run the inv command And to make the permissions work in your plugin have this: PHP: public function onCommand(CommandSender $sender, Command $command, $label, array $args){ if(strtolower($command->getName()) === "info"){ if($sender->hasPermission("example.command.info")){ //It will run the code here is the sender has the permission node }else{ //If the sender doesn't have permission, it will run this code } }elseif(strtolower($command->getName()) === "quit"){ // Same thing here, and same for the other command }}
Thanks @BlupperBoy333 for helping . I compiled the script I had into a phar. i need help https://github.com/DunxGit/InfComs/issues/4