FANDOM


A permission node is a simple piece of code which restricts a certain command, or group of commands, to a specific player or group. This can be useful as it can limit a plugin’s functionality, say for example you wanted an “Admin” group to be able to ban people, but at the same time you don’t want everyone to be able to ban. All you have to do is add the permission node which allows access to the ban command to the “Admin” group, and voila! only admins can ban people!

How it worksEdit

Permission nodes are some of the easiest things to add to a plugin as a permission node is nothing more than a basic boolean function. When a command is run the plugin will check to see if the issuer has that command’s permission node, if they do they are allowed access to the command, if not they are not allowed access to the command and are usually given an error message.

ExampleEdit


if (commandLabel.equalsIgnoreCase(“hello”)) {
     if (sender.hasPermission(“pluginname.hello”)) {
          sender.sendMessage(ChatColor.GREEN + “Hello!”);
          return true;
     } else {
          sender.sendMessage(ChatColor.RED + “Error: You do not have permission to use the /hello command!”);
          return false;
     }
}

As you can see in the example above, if a player issues the command /hello the plugin will check for the pluginname.hello permission node, if the players has that node it will send the player the message: Hello! However, if the player does not have the appropriate permission node the plugin will send the message: Error: You do not have permission to use the /hello command!

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.