Adding a permission node to plugin.yml

In the Enchanter project, open the plugin.yml file. Adding permission nodes is similar to how commands are added. On a new line, add permissions:. Ensure that this line is not indented at all. On the lines that follow, add each permission node that our plugin will use, followed by a colon. The next few lines will provide the attributes of the permission, such as its description. The following code is an example of how the plugin.yml file will look with the enchant permission node added. Ensure that the indentations are similar. Note that the version attribute should also be updated to indicate that this is a new and improved version of the Enchanter plugin:

name: Enchanter
version: 0.2
main: com.codisimus.enchanter.Enchanter
description: Used to quickly put enchantments on an item
commands:
  enchant:
    aliases: e
    description: Adds enchantments to the item in your hand
    usage: Hold the item you wish to enchant and type /enchant
permissions:
  enchanter.enchant:
    description: Needed to use the enchant command
    default: op

The default attribute can be set to true, false, op, or not op. This determines who will have this permission; true means that everyone will have this permission, false means that no one will have it, op means that only operators will have it, and not op means that everyone except for the operators will have it. Who has this permission can be further modified by using a permission plugin, which will be discussed later in this chapter.

Just like with commands, you can assign multiple permissions to a plugin. For more information on the plugin.yml file, visit http://wiki.bukkit.org/Plugin_YAML.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.249.158