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
ConstructorDescriptionAbstractCommand
(@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 String
getName()
Gets the command name.@NotNull String
Gets the permission node.onTabComplete
(@NotNull org.bukkit.command.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:Command
Gets the command name. -
getPermissionNode
Description copied from interface:Command
Gets the permission node.- Specified by:
getPermissionNode
in interfaceCommand
- Returns:
- the permission node
-
getAliases
Description copied from interface:Command
Gets the set of aliases.- Specified by:
getAliases
in interfaceCommand
- 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 interfaceCommand
- Parameters:
sender
- the executorargs
- the array of arguments- Returns:
- the result of the tab-completion or an empty list
-