Package com.booksaw.betterTeams.commands
Class SubCommand
java.lang.Object
com.booksaw.betterTeams.commands.SubCommand
- Direct Known Subclasses:
AllyTeama,AnchorTeama,BaltopCommand,ChatSpyTeama,ChestCheckCommand,ChestDisableClaims,ChestEnableClaims,ChestRemoveTeama,CreateHoloTeama,CreateTeama,DelwarpTeama,DemoteTeama,HelpCommand,HomeTeama,ImportmessagesTeama,InfoCommand,JoinTeama,LeaveTeama,ListCommand,MoneySubCommand,NeutralTeama,NoTeamSubCommand,ParentCommand,PromoteTeama,PurgeTeama,RankCommand,ReloadTeama,RemoveHoloTeama,ScoreSubCommand,SetAnchorTeama,SetOwnerTeama,SetwarpTeama,TeamSelectSubCommand,TeamSubCommand,TeleportTeama,TitleTeama,TopCommand,VersionTeama,WarpTeama
This class is used by any commands which are included within a command tree
(for example /command subcommand)
- Author:
- booksaw
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMetaStringList(List<String> options, Team team, String argument) voidaddPlayerStringList(List<String> options, String argument) This can be used during the tab complete process to get a string list of all players on the servervoidaddTeamStringList(List<String> options, String argument) voidaddTeamStringList(List<String> options, String argument, @Nullable Collection<UUID> ignoreTheseTeams, @Nullable Collection<UUID> onlyAllowTheseTeams) booleancheckAsync(String[] args) getArgMessage(ParentCommand parent) This method is used to load the help message from the file, or if there is not one, it will get the default messageabstract Stringabstract StringgetCommandAndArgMessage(ParentCommand parent) abstract StringgetHelp()getHelpMessage(ParentCommand parent) This method is used to load the help message from the file, or if there is not one, it will get the default messageabstract intreturn -1 if there is no capabstract intUsed to get the minimum number of arguments which need to be parsed into this commandabstract StringgetNode()booleanUsed to check if the commandSender needs to be a player, defaults to falseabstract CommandResponseThis method is called whenever the sub command is run, return the message (+ chat color if it should not be the default chat color)abstract voidonTabComplete(List<String> options, org.bukkit.command.CommandSender sender, String label, String[] args) protected boolean
-
Constructor Details
-
SubCommand
public SubCommand()
-
-
Method Details
-
getHelpMessage
This method is used to load the help message from the file, or if there is not one, it will get the default message- Parameters:
parent- the Parent command controlling the sub command- Returns:
- the help message for the subcommand
-
getCommandAndArgMessage
-
getArgMessage
This method is used to load the help message from the file, or if there is not one, it will get the default message- Returns:
- the help message for the subcommand
-
onCommand
public abstract CommandResponse onCommand(org.bukkit.command.CommandSender sender, String label, String[] args) This 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
- 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
-
getCommand
- Returns:
- the sub-command which this class handles
-
getNode
- Returns:
- the permission node for that sub command
-
getHelp
- Returns:
- the help information for that sub command (this does not include the arguments)
-
getArguments
- Returns:
- the arguments for that sub command ie '[name]'
-
getMinimumArguments
public abstract int getMinimumArguments()Used to get the minimum number of arguments which need to be parsed into this command- Returns:
- the number of minimum arguments
-
getMaximumArguments
public abstract int getMaximumArguments()return -1 if there is no cap- Returns:
- the maximum number of arguments for the command
-
needPlayer
public boolean needPlayer()Used to check if the commandSender needs to be a player, defaults to false- Returns:
- if the commandSender needs to be a player
-
onTabComplete
-
runAsync
-
checkAsync
-
addPlayerStringList
This can be used during the tab complete process to get a string list of all players on the server- Parameters:
options- the tab complete list to work onargument- the details of that argument that have already been entered (ie 'boo' when typing 'booksaw')
-
addTeamStringList
-
addTeamStringList
public void addTeamStringList(List<String> options, String argument, @Nullable @Nullable Collection<UUID> ignoreTheseTeams, @Nullable @Nullable Collection<UUID> onlyAllowTheseTeams) -
addMetaStringList
-