Class AbstractCommand

java.lang.Object
net.okocraft.box.api.command.AbstractCommand
All Implemented Interfaces:
Command

public abstract class AbstractCommand extends Object implements Command
An abstract class for a sub command of /box or /boxadmin.

name is used as in /box <name>.

The permission node is for executing that command, and it will check the executor before Command.onCommand(CommandSender, String[]) is called.

  • Constructor Details

    • AbstractCommand

      public AbstractCommand(@NotNull @NotNull String name, @NotNull @NotNull String permissionNode)
      The constructor of AbstractCommand.
      Parameters:
      name - the command name
      permissionNode - the permission node
    • AbstractCommand

      public AbstractCommand(@NotNull @NotNull String name, @NotNull @NotNull String permissionNode, @NotNull @NotNull Set<String> aliases)
      The constructor of AbstractCommand.
      Parameters:
      name - the command name
      permissionNode - the permission node
      aliases - the set of aliases
  • Method Details

    • getName

      @NotNull public @NotNull String getName()
      Description copied from interface: Command
      Gets the command name.
      Specified by:
      getName in interface Command
      Returns:
      the command name
    • getPermissionNode

      @NotNull public @NotNull String getPermissionNode()
      Description copied from interface: Command
      Gets the permission node.
      Specified by:
      getPermissionNode in interface Command
      Returns:
      the permission node
    • getAliases

      @NotNull public @NotNull @Unmodifiable Set<String> getAliases()
      Description copied from interface: Command
      Gets the set of aliases.
      Specified by:
      getAliases in interface Command
      Returns:
      the set of aliases
    • onTabComplete

      @NotNull public @NotNull List<String> onTabComplete(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull String[] args)
      Description copied from interface: Command
      Gets the tab-completion.

      When this method is called, the executor has the permission and the length of the argument array is greater than or equal to 1.

      Specified by:
      onTabComplete in interface Command
      Parameters:
      sender - the executor
      args - the array of arguments
      Returns:
      the result of the tab-completion or an empty list