Class CompositeCommand

All Implemented Interfaces:
Command, org.bukkit.command.TabCompleter
Direct Known Subclasses:
BaseCommandExecutor

public class CompositeCommand extends AbstractTabCompleter implements Command, org.bukkit.command.TabCompleter
Command with nested commandMap inside.
  • Field Details

  • Constructor Details

    • CompositeCommand

      public CompositeCommand(String name, String permission, String description)
    • CompositeCommand

      public CompositeCommand(String name, String permission, String params, String description, UUID... permissionOverride)
  • Method Details

    • add

      public CompositeCommand add(Command... cmds)
    • addTab

      public CompositeCommand addTab(String arg, org.bukkit.command.TabCompleter tab)
    • getName

      public String getName()
      Description copied from interface: Command
      Returns the name of the sub-command.
      Specified by:
      getName in interface Command
    • getAliases

      public String[] getAliases()
      Description copied from interface: Command
      Returns aliases for the command. Can be empty, cannot be null.
      Specified by:
      getAliases in interface Command
    • getPermission

      public String getPermission()
      Description copied from interface: Command
      The permission of the command. Can be null.
      Specified by:
      getPermission in interface Command
    • getDescription

      public String getDescription()
      Description copied from interface: Command
      A short description of the sub-command. Used when listing the commands with others.
      Specified by:
      getDescription in interface Command
    • getUsage

      public String getUsage()
      Description copied from interface: Command
      A more verbatim description of the command. Used when /command help is executed.
      Specified by:
      getUsage in interface Command
    • getParams

      public String[] getParams()
      Description copied from interface: Command
      The list of parameters accepted by the command. Can be empty, not null.
      Specified by:
      getParams in interface Command
    • execute

      public boolean execute(org.bukkit.command.CommandSender sender, String alias, Map<String,​Object> data, String... args)
      Description copied from interface: Command
      Executes the command.
      Specified by:
      execute in interface Command
    • showUsage

      public void showUsage(org.bukkit.command.CommandSender sender, int page)
    • getParamsAsString

      public static String getParamsAsString(Command cmd)
    • hasAccess

      public boolean hasAccess(Command cmd, org.bukkit.command.CommandSender sender)
    • onTabComplete

      public List<String> onTabComplete(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String alias, String[] args)
      Specified by:
      onTabComplete in interface org.bukkit.command.TabCompleter
      Overrides:
      onTabComplete in class AbstractTabCompleter
    • getTabCompleter

      public org.bukkit.command.TabCompleter getTabCompleter()
      Description copied from interface: Command
      Optional TabCompleter to override the default ones. Can be null
      Specified by:
      getTabCompleter in interface Command
    • getParent

      public CompositeCommand getParent()
      Description copied from interface: Command
      Returns the parent command (if one such is available). May return null.
      Specified by:
      getParent in interface Command
    • setParent

      public void setParent(CompositeCommand parent)
      Description copied from interface: Command
      Assigns a parent command.
      Specified by:
      setParent in interface Command
    • getChildren

      public List<Command> getChildren()
    • accept

      public void accept(CommandVisitor visitor)
      Description copied from interface: Command
      Visitor pattern.
      Specified by:
      accept in interface Command
      Parameters:
      visitor - A visitor for this node.
    • addFeaturePermission

      public void addFeaturePermission(String perm, String description)
    • getFeaturePermissions

      public Map<String,​String> getFeaturePermissions()
      Description copied from interface: Command
      Returns a map of feature-toggling permissions supporte by this command.
      Specified by:
      getFeaturePermissions in interface Command
      Returns:
      A map of permission-node as key, and description as value.
    • hasPermissionOverride

      public boolean hasPermissionOverride(org.bukkit.command.CommandSender sender)
    • hasPermission

      public boolean hasPermission(org.bukkit.command.CommandSender sender, String permission)
      Description copied from interface: Command
      Allows for other than permission checking
      Specified by:
      hasPermission in interface Command
      Parameters:
      sender - The commandSender requesting permission
      permission - The permission
      Returns:
      true if the sender can execute this command