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

public abstract class SubCommand extends Object
This class is used by any commands which are included within a command tree (for example /command subcommand)
Author:
booksaw
  • Constructor Details

    • SubCommand

      public SubCommand()
  • Method Details

    • getHelpMessage

      public String 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 message
      Parameters:
      parent - the Parent command controlling the sub command
      Returns:
      the help message for the subcommand
    • getCommandAndArgMessage

      public String getCommandAndArgMessage(ParentCommand parent)
    • getArgMessage

      public String 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 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 command
      label - 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

      public abstract String getCommand()
      Returns:
      the sub-command which this class handles
    • getNode

      public abstract String getNode()
      Returns:
      the permission node for that sub command
    • getHelp

      public abstract String getHelp()
      Returns:
      the help information for that sub command (this does not include the arguments)
    • getArguments

      public abstract String 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

      public abstract void onTabComplete(List<String> options, org.bukkit.command.CommandSender sender, String label, String[] args)
    • runAsync

      protected boolean runAsync(String[] args)
    • checkAsync

      public boolean checkAsync(String[] args)
    • addPlayerStringList

      public void addPlayerStringList(List<String> options, String argument)
      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 on
      argument - the details of that argument that have already been entered (ie 'boo' when typing 'booksaw')
    • addTeamStringList

      public void addTeamStringList(List<String> options, String argument)
    • addTeamStringList

      public void addTeamStringList(List<String> options, String argument, @Nullable @Nullable Collection<UUID> ignoreTheseTeams, @Nullable @Nullable Collection<UUID> onlyAllowTheseTeams)
    • addMetaStringList

      public void addMetaStringList(List<String> options, Team team, String argument)