Chapter 5. Plugin Commands
The nice thing about the Bukkit API is that it has the basic features already built into its framework. As programmers, we need not go out of our way to implement these basic features into plugins. In this chapter, we will discuss one of these features, namely the in-game commands that can be executed by a player. These are similar to the commands that you are already familiar with, such as /reload
, /gamemode
, or /give
. We will create a plugin that will enchant an item. By the end of this chapter, once the plugin is complete, you will be able to type /enchant
to add your favorite enchantments to the item in your hand.
Commands are one of the easiest ways for players to communicate with a plugin. They also allow players to trigger the execution of a plugin's code. For these reasons, most plugins will have some sort of command. The Bukkit development team realized this and provided us with a simple way to register commands. Registering commands through...