Class Command

java.lang.Object
net.md_5.bungee.api.plugin.Command
Direct Known Subclasses:
PlayerCommand

public abstract class Command extends Object
A command that can be executed by a CommandSender.
  • Constructor Details

    • Command

      public Command(String name)
      Construct a new command with no permissions or aliases.
      Parameters:
      name - the name of this command
    • Command

      public Command(String name, String permission, String... aliases)
      Construct a new command.
      Parameters:
      name - primary name of this command
      permission - the permission node required to execute this command, null or empty string allows it to be executed by everyone
      aliases - aliases which map back to this command
  • Method Details

    • execute

      @Deprecated public void execute(CommandSender sender, String[] args)
      Deprecated.
      new execute method, including alias. Migrate to execute(CommandSender, String, String[])
      Execute this command with the specified sender and arguments.
      Parameters:
      sender - the executor of this command
      args - arguments used to invoke this command
    • execute

      public void execute(CommandSender sender, String alias, String[] args)
      Execute this command with the specified sender, alias and arguments.
      Parameters:
      sender - the executor of this command
      alias - the alias of which the command was invoked
      args - arguments used to invoke this command
    • hasPermission

      public boolean hasPermission(CommandSender sender)
      Check if this command can be executed by the given sender.
      Parameters:
      sender - the sender to check
      Returns:
      whether the sender can execute this
    • setPermissionMessage

      protected void setPermissionMessage(String permissionMessage)
    • setPermissionMessageComponent

      protected void setPermissionMessageComponent(BaseComponent[] permissionMessageComponent)
    • getName

      public String getName()
    • getPermission

      public String getPermission()
    • getAliases

      public String[] getAliases()
    • getPermissionMessage

      public String getPermissionMessage()
    • getPermissionMessageComponent

      public BaseComponent[] getPermissionMessageComponent()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object