Chapter 6. Player Permissions

Player Permissions is one feature that nearly every Bukkit server administrator wants to have on their server. In vanilla Minecraft, you are either an OP (operator), or simply a regular player. With permissions, you can create an infinite number of ranks between the two. There are several permission plugins available, which can be found on the Bukkit or Spigot websites. In the past, developers had to write their own code in order to support one or more of these permission systems. Luckily, the Bukkit API now has a basis for player permissions, which makes our job easier. We no longer need to learn a new API for every permissions plugin that exists. We only need to support Bukkit's universal permissions system, which we can be sure will not change drastically at any moment. In this chapter, you will do just that and install a permissions plugin that helps you organize each player's permissions. By the end of this chapter, you will be able to control your server in a way that ensures that untrusted players will not be able to spoil the fun for everyone else. We will cover the following topics in this chapter:

  • The benefits of using permissions on your server and in plugins
  • What a permission node is and how it is used by developers and server administrators
  • Adding a permission node to the plugin.yml file
  • Assigning a permission node to one of your plugin's commands
  • Testing player permissions in-game
  • Installing and configuring a third-party permissions plugin
  • Using permission nodes throughout your plugin

The benefits of permissions

Permissions give you more control over the players on your server. They allow you to prevent abuse from untrusted players. With permissions, you can give each player a specific rank based on their role in the server and how trustworthy they are. Let's say that you want to give a specific player the ability to teleport to the location of some other players. With permissions, you can do so without giving that same player the ability to spawn items, kick/ban other players, and even stop your server completely! The simplest example of a useful permission is not giving new players the permission to build. This prevents someone from logging on to your server with the sole intention of defacing the world. They will be unable to destroy your or other players' buildings.

When programming plugins, you can assign certain permissions to specific commands or actions. This allows you to give the benefits of your plugins to privileged people only. For example, you may want only your good friend and yourself to have the option of enchanting your items using the enchant command. The first step to accomplishing this is to know what permission nodes are and how they work.

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

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