🧒Sub commands

Every sub-command must be registered in the parent command class.

Every sub-command must implement SubCommand interface.

The sub-command has two methods:

  • executeCommand - executes subcommand

  • getName - gets sub-command name

The whole implementation of the sub-command class.

public class MySubCommand implements SubCommand {

    @Override
    public boolean executeCommand(CommandSender sender, String[] args) {
        Player player = (Player) sender;

        player.sendMessage("my sub command");
        
        return false;
    }

    @Override
    public String getName() {
        return "mysubcommand";
    }
}