Solved Registering a class that extends Command

Discussion in 'Spigot Plugin Development' started by ritolika, Jun 4, 2016.

  1. So I have a class that extends org.bukkit.command.Command.
    I have no Idea how to register it so that it can be used in-game.
    Does anyone know how to do it? As this is the first time I use per-class commands, I'm kind of lost.


    Code (Text):
    public class CreateCommand extends Command {

        protected CreateCommand(String name) {
            super(name);
            // TODO Auto-generated constructor stub
        }

        @Override
        public boolean execute(CommandSender arg0, String arg1, String[] arg2) {
            // TODO Auto-generated method stub
            return false;
        }

     

    }
     
  2. To make per-class commands, you implement CommandExecutor, and in the onEnable(), put

    getCommand("cmdname").setExecutor(new CommandClass());
     
  3. I'm trying to create a command per class not multiple CommandExecutors. So basically each command class handles the command itself, (if this is possible).