Class CyberSubCommand
java.lang.Object
com.github.cyberryan1.cybercore.spigot.command.settings.CommandSettings
com.github.cyberryan1.cybercore.spigot.command.settings.BaseCommand
com.github.cyberryan1.cybercore.spigot.command.CyberSubCommand
Used to easily create a subcommand that can then be added to a
CyberSuperCommand
.-
Constructor Summary
ConstructorsConstructorDescriptionCyberSubCommand
(String name, String usage) Creates a new CyberSubCommand with the provided arguments.CyberSubCommand
(String name, String permission, String usage) Creates a new CyberSubCommand with the provided arguments.CyberSubCommand
(String name, String permission, String permissionMsg, String usage) Creates a new CyberSubCommand with the provided arguments. -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
execute
(SentCommand superCommand, SentSubCommand subCommand) The execute method is called when the player executes a subcommand.final boolean
onCommand
(SentCommand superCommand, String subcommandLabel, String[] subcommandArgs) This should be ignored by most developersonTabComplete
(SentCommand superCommand, String subcommandLabel, String[] subcommandArgs) This should be ignored by most developerstabComplete
(SentCommand superCommand, SentSubCommand subCommand) The tabComplete method is called when the player presses tab while typing a subcommand.Methods inherited from class com.github.cyberryan1.cybercore.spigot.command.settings.BaseCommand
getArgIndexes, getArgType, getArgTypes, getMinArgLength, getStringArgOptions, getStringArgOptions, isSendingValidationMsg, isValidatingArgs, sendInvalidDoubleArg, sendInvalidIntegerArg, sendInvalidPlayerArg, sendPermissionMsg, sendPermMsg, sendUsage, setArgType, setMinArgLength, setSendValidationMsg, setStringArgOptions, setValidateArgs, validateArgument
Methods inherited from class com.github.cyberryan1.cybercore.spigot.command.settings.CommandSettings
demandConsole, demandPermission, demandPlayer, getInvalidDoubleMsg, getInvalidIntegerMsg, getInvalidPlayerMsg, getName, getPermission, getPermissionMsg, getUsage, isDemandConsole, isDemandPermission, isDemandPlayer, isTabCompleteEnabled, permissionsAllowed, permsAllowed, runAsync, setDemandConsole, setDemandPermission, setDemandPlayer, setInvalidDoubleMsg, setInvalidIntegerMsg, setInvalidPlayerMsg, setRunAsync, setTabCompleteEnabled
-
Constructor Details
-
CyberSubCommand
Creates a new CyberSubCommand with the provided arguments.- Parameters:
name
- The name of the subcommandpermission
- The permission to use the subcommand (null for no permission)permissionMsg
- The message to send to the player if they do not have the permissionusage
- The usage of the subcommand
-
CyberSubCommand
Creates a new CyberSubCommand with the provided arguments. The permission message is set to the default permission message provided byCyberCommandUtils.getDefaultPermissionMsg()
.- Parameters:
name
- The name of the subcommandpermission
- The permission to use the subcommand (null for no permission)usage
- The usage of the subcommand
-
CyberSubCommand
Creates a new CyberSubCommand with the provided arguments. The permission message is set to the default permission message provided byCyberCommandUtils.getDefaultPermissionMsg()
. The permission is assumed to be null, meaning that no permission is needed to execute this command.- Parameters:
name
- The name of the subcommandusage
- The usage of the subcommand
-
-
Method Details
-
onTabComplete
public final List<String> onTabComplete(SentCommand superCommand, String subcommandLabel, String[] subcommandArgs) This should be ignored by most developers -
tabComplete
The tabComplete method is called when the player presses tab while typing a subcommand.Returning an empty list will do the following:
- If the argument the command sender is currently typing has been set (viaBaseCommand.setArgType(int, ArgType)
) to eitherArgType.ONLINE_PLAYER
orArgType.OFFLINE_PLAYER
), then a list of players will be sent to the command sender.
- If the above yields no results, an empty list will be sent to the command sender.
To override this behavior, return a list containing one string that is empty, and that will be returned instead.- Parameters:
superCommand
- TheSentCommand
of the command that is being typedsubCommand
- TheSentSubCommand
of the subcommand that is being typed- Returns:
- A list of strings to return to the command sender
-
onCommand
public final boolean onCommand(SentCommand superCommand, String subcommandLabel, String[] subcommandArgs) This should be ignored by most developers -
execute
The execute method is called when the player executes a subcommand. All information about the supercommand, subcommand, who executed it, the arguments, etc. are provided in theSentCommand
andSentSubCommand
parametersThe value returned by this method will be returned to the
CommandExecutor.onCommand(CommandSender, Command, String, String[])
method.- Parameters:
superCommand
- TheSentCommand
of the command that was executedsubCommand
- TheSentSubCommand
of the subcommand that was executed- Returns:
- What to return to the
CommandExecutor.onCommand(CommandSender, Command, String, String[])
method - See Also:
-
CommandExecutor.onCommand(CommandSender, Command, String, String[])
-