Package net.md_5.bungee.api.plugin
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 aCommandSender
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
canEqual(Object other)
boolean
equals(Object o)
abstract void
execute(CommandSender sender, String[] args)
Execute this command with the specified sender and arguments.String[]
getAliases()
String
getName()
String
getPermission()
String
getPermissionMessage()
int
hashCode()
boolean
hasPermission(CommandSender sender)
Check if this command can be executed by the given sender.protected void
setPermissionMessage(String permissionMessage)
String
toString()
-
-
-
Constructor Detail
-
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 commandpermission
- the permission node required to execute this command, null or empty string allows it to be executed by everyonealiases
- aliases which map back to this command
-
-
Method Detail
-
execute
public abstract void execute(CommandSender sender, String[] args)
Execute this command with the specified sender and arguments.- Parameters:
sender
- the executor of this commandargs
- 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
-
getName
public String getName()
-
getPermission
public String getPermission()
-
getAliases
public String[] getAliases()
-
getPermissionMessage
public String getPermissionMessage()
-
canEqual
protected boolean canEqual(Object other)
-
setPermissionMessage
protected void setPermissionMessage(String permissionMessage)
-
-