Package com.booksaw.betterTeams.commands
Class ParentCommand
java.lang.Object
com.booksaw.betterTeams.commands.SubCommand
com.booksaw.betterTeams.commands.ParentCommand
- Direct Known Subclasses:
PermissionParentCommand
This is used for any parent commands across the system
- Author:
- booksaw
-
Constructor Summary
ConstructorsConstructorDescriptionParentCommand(CostManager prices, CooldownManager cooldowns, String command, boolean runAsync) ParentCommand(String command) Creates a new parent command with a set of sub commands -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSubCommand(SubCommand command) this method adds another command to the parent commandvoidaddSubCommands(SubCommand... commands) Add multiple subcommands (seeaddSubCommand(SubCommand))booleancheckAsync(String[] args) Used to store what the parent command reference isgetHelp()intreturn -1 if there is no capintUsed to get the minimum number of arguments which need to be parsed into this commandgetNode()getReference(SubCommand subCommand) Used to store all applicable sub commandsThis method is called whenever the sub command is run, return the message (+ chat color if it should not be the default chat color)voidonTabComplete(List<String> options, org.bukkit.command.CommandSender sender, String label, String[] args) protected booleanMethods inherited from class com.booksaw.betterTeams.commands.SubCommand
addMetaStringList, addPlayerStringList, addTeamStringList, addTeamStringList, getArgMessage, getCommandAndArgMessage, getHelpMessage, needPlayer
-
Constructor Details
-
ParentCommand
Creates a new parent command with a set of sub commands- Parameters:
command- the command which will be defaulted to if the user enters an incorrect command
-
ParentCommand
public ParentCommand(CostManager prices, CooldownManager cooldowns, String command, boolean runAsync)
-
-
Method Details
-
addSubCommands
Add multiple subcommands (seeaddSubCommand(SubCommand))- Parameters:
commands- The command(s) to add
-
addSubCommand
this method adds another command to the parent command- Parameters:
command- the command to add
-
onCommand
public CommandResponse onCommand(org.bukkit.command.CommandSender sender, String label, String[] args) Description copied from class:SubCommandThis method is called whenever the sub command is run, return the message (+ chat color if it should not be the default chat color)
The return value should be the value of the message to be sent to the user, for more complicated messaging systems return null
- Specified by:
onCommandin classSubCommand- Parameters:
sender- the person who called the commandlabel- the label of the initial command (useful for help files)args- the arguments of the sub command (starting at args[0], as the sub command itself will be removed)- Returns:
- the message
-
onCommand
public CommandResponse onCommand(org.bukkit.command.CommandSender sender, String label, String[] args, boolean first) -
getMinimumArguments
public int getMinimumArguments()Description copied from class:SubCommandUsed to get the minimum number of arguments which need to be parsed into this command- Specified by:
getMinimumArgumentsin classSubCommand- Returns:
- the number of minimum arguments
-
getNode
- Specified by:
getNodein classSubCommand- Returns:
- the permission node for that sub command
-
getHelp
- Specified by:
getHelpin classSubCommand- Returns:
- the help information for that sub command (this does not include the arguments)
-
getArguments
- Specified by:
getArgumentsin classSubCommand- Returns:
- the arguments for that sub command ie '[name]'
-
onTabComplete
public void onTabComplete(List<String> options, org.bukkit.command.CommandSender sender, String label, String[] args) - Specified by:
onTabCompletein classSubCommand
-
getMaximumArguments
public int getMaximumArguments()Description copied from class:SubCommandreturn -1 if there is no cap- Specified by:
getMaximumArgumentsin classSubCommand- Returns:
- the maximum number of arguments for the command
-
getReference
-
runAsync
- Overrides:
runAsyncin classSubCommand
-
checkAsync
- Overrides:
checkAsyncin classSubCommand
-
getSubCommands
Used to store all applicable sub commands -
getCommand
Used to store what the parent command reference is- Specified by:
getCommandin classSubCommand- Returns:
- the sub-command which this class handles
-