Tutorial by Examples

To handle a command, you must have a class that implements the CommandExecutor interface. The JavaPlugin class (your plugin's main class) already implements this. When implementing the CommandExecutor interface, the following method must be implemented: public boolean onCommand(CommandSender sende...
This example shows a very basic example of how to utilize onCommand. I don't suggest processing your commands directly in onCommand, but this does the trick for this simple case. In this example we attempt to set the player's gamemode. The first thing we need to do is make sure that the sender isn...
If you have a lot of commands, you shouldn't put them all in the main class. Make a new class and have it implement CommandExecutor Add the following to the class: @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { } In your...

Page 1 of 1