Class SubCommand

java.lang.Object
me.neznamy.tab.shared.command.SubCommand
Direct Known Subclasses:
AnnounceBarCommand, AnnounceCommand, AnnounceScoreboardCommand, BossBarCommand, CpuCommand, DebugCommand, GroupsCommand, MySQLCommand, NameTagCommand, ParseCommand, PropertyCommand, ReloadCommand, ScoreboardCommand, SendBarCommand, SendCommand, SetCollisionCommand, TabCommand, WidthCommand

public abstract class SubCommand extends Object
Abstract class representing a subcommand of "/tab" command
  • Field Details

    • extraProperties

      protected final List<String> extraProperties
  • Constructor Details

    • SubCommand

      protected SubCommand(String name, String permission)
      Constructs new instance with given parameters
      Parameters:
      name - command name
      permission - permission requirement
  • Method Details

    • registerSubCommand

      public void registerSubCommand(SubCommand subcommand)
      Registers new subcommand
      Parameters:
      subcommand - subcommand to register
    • getName

      public String getName()
      Returns name of this command
      Returns:
      name of this command
    • hasPermission

      public boolean hasPermission(me.neznamy.tab.api.TabPlayer sender)
      Returns whether player has permission to run this command or not
      Parameters:
      sender - player who ran command or null if console
      Returns:
      true if sender has permission or is console, false otherwise
    • hasPermission

      public boolean hasPermission(me.neznamy.tab.api.TabPlayer sender, String permission)
      Returns whether player has given permission or not
      Parameters:
      sender - player who ran command or null if console
      permission - permission to check for
      Returns:
      true if sender has permission or is console, false otherwise
    • sendMessages

      public void sendMessages(me.neznamy.tab.api.TabPlayer sender, List<String> messages)
      Sends messages to the command sender with colors translated
      Parameters:
      sender - player or console to send the message to
      messages - messages to send
    • sendMessage

      public void sendMessage(me.neznamy.tab.api.TabPlayer sender, String message)
      Sends message to the command sender with colors translated
      Parameters:
      sender - player or console to send the message to
      message - the message to sent
    • sendRawMessage

      public void sendRawMessage(me.neznamy.tab.api.TabPlayer sender, String message)
      Sends message to the command sender without colors translated
      Parameters:
      sender - player or console to send the message to
      message - the message to sent
    • getOnlinePlayers

      public List<String> getOnlinePlayers(String nameStart)
      Returns all players whose name start with given string
      Parameters:
      nameStart - beginning of the name
      Returns:
      List of compatible players
    • getStartingArgument

      public List<String> getStartingArgument(Collection<String> values, String argument)
    • complete

      public List<String> complete(me.neznamy.tab.api.TabPlayer sender, String[] arguments)
      Performs command complete and returns list of arguments to be shown
      Parameters:
      sender - command sender
      arguments - arguments inserted in chat so far
      Returns:
      List of possible arguments
    • getMessages

      public MessageFile getMessages()
    • execute

      public abstract void execute(me.neznamy.tab.api.TabPlayer sender, String[] args)
      Performs the command
      Parameters:
      sender - command sender or null if console
      args - arguments of the command
    • getAllProperties

      public static String[] getAllProperties()
    • setAllProperties

      public static void setAllProperties(String[] allProperties)
    • getSubcommands

      public Map<String,SubCommand> getSubcommands()