bukkit Commands Command not in main class


If you have a lot of commands, you shouldn't put them all in the main class.

  1. Make a new class and have it implement CommandExecutor

  2. Add the following to the class:

     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  3. In your main class add in the onEnable (replace commandName with the name of the command and CommandExecutor with the name of the class):

     getCommand("commandName").setExecutor(new CommandExecutor());