Class AbstractCommand

java.lang.Object
dk.lockfuglsang.minecraft.command.AbstractCommand
All Implemented Interfaces:
Command
Direct Known Subclasses:
DocumentCommand, LanguageCommand

public abstract class AbstractCommand extends Object implements Command
Convenience implementation of the Command
  • Constructor Details

    • AbstractCommand

      public AbstractCommand(String name, String permission, String params, String description, String usage, UUID... permissionOverride)
    • AbstractCommand

      public AbstractCommand(String name, String permission, String params, String description)
    • AbstractCommand

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

      public AbstractCommand(String name, String description)
  • Method Details

    • 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
    • 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
    • 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.
    • join

      public static String join(String[] args, String delim)
      Convenience method until we can fully rely on everybody running JRE 8.
      Parameters:
      args - A list of arguments
      delim - Delimiter to join them
      Returns:
      A string containing the arguments concatenated.
    • join

      public static String join(String[] args)
    • 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