Class SubCommand
java.lang.Object
com.github.pinont.singularitylib.api.command.SubCommand
A subcommand within a
CommandGroup. Implementations provide a name,
optional permission, and the execution + tab-completion for their own args.
Usage (from a CommandGroup):
group.registerSubcommand(new MySubCommand());
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancheckConsole(org.bukkit.command.CommandSender sender) Checks that the sender is allowed for this subcommand (console vs player).protected booleancheckPermission(org.bukkit.command.CommandSender sender) Checks the sender's permission for this subcommand.voidConvenience overload used byCommandGroup(extracts the sender).abstract voidExecutes the subcommand.abstract StringgetName()booleanOptionally restrict to players only.
-
Constructor Details
-
SubCommand
public SubCommand()
-
-
Method Details
-
getName
- Returns:
- the subcommand name (first arg after the root label)
-
getPermission
- Returns:
- optional permission node (e.g. "mineplugin.admin"), or
null/""for none
-
getDescription
- Returns:
- short description shown in the auto-generated help menu
-
execute
Executes the subcommand.- Parameters:
sender- the command senderargs- the arguments AFTER the subcommand name
-
execute
Convenience overload used byCommandGroup(extracts the sender). -
isPlayerOnly
public boolean isPlayerOnly()Optionally restrict to players only.- Returns:
- true if this subcommand requires a Player sender
-
checkPermission
protected boolean checkPermission(org.bukkit.command.CommandSender sender) Checks the sender's permission for this subcommand. -
checkConsole
protected boolean checkConsole(org.bukkit.command.CommandSender sender) Checks that the sender is allowed for this subcommand (console vs player).
-