Package net.okocraft.box.api.command
Class AbstractCommand
java.lang.Object
net.okocraft.box.api.command.AbstractCommand
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionAbstractCommand(@NotNull String name, @NotNull String permissionNode) The constructor ofAbstractCommand.AbstractCommand(@NotNull String name, @NotNull String permissionNode, @NotNull Set<String> aliases) The constructor ofAbstractCommand. -
Method Summary
Modifier and TypeMethodDescriptionGets the set of aliases.@NotNull StringgetName()Gets the command name.@NotNull StringGets the permission node.onTabComplete(@NotNull CommandSender sender, @NotNull String[] args) Gets the tab-completion.
-
Constructor Details
-
AbstractCommand
The constructor ofAbstractCommand.- Parameters:
name- the command namepermissionNode- the permission node
-
AbstractCommand
public AbstractCommand(@NotNull @NotNull String name, @NotNull @NotNull String permissionNode, @NotNull @NotNull Set<String> aliases) The constructor ofAbstractCommand.- Parameters:
name- the command namepermissionNode- the permission nodealiases- the set of aliases
-
-
Method Details
-
getName
Description copied from interface:CommandGets the command name. -
getPermissionNode
Description copied from interface:CommandGets the permission node.- Specified by:
getPermissionNodein interfaceCommand- Returns:
- the permission node
-
getAliases
Description copied from interface:CommandGets the set of aliases.- Specified by:
getAliasesin interfaceCommand- Returns:
- the set of aliases
-
onTabComplete
@NotNull public @NotNull List<String> onTabComplete(@NotNull @NotNull CommandSender sender, @NotNull @NotNull String[] args) Description copied from interface:CommandGets 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:
onTabCompletein interfaceCommand- Parameters:
sender- the executorargs- the array of arguments- Returns:
- the result of the tab-completion or an empty list
-