|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.bukkit.command.Command
public abstract class Command
Represents a Command, which executes various tasks upon user input
Field Summary | |
---|---|
protected String |
description
|
protected String |
usageMessage
|
Constructor Summary | |
---|---|
protected |
Command(String name)
|
protected |
Command(String name,
String description,
String usageMessage,
List<String> aliases)
|
Method Summary | |
---|---|
static void |
broadcastCommandMessage(CommandSender source,
String message)
|
static void |
broadcastCommandMessage(CommandSender source,
String message,
boolean sendToSource)
|
abstract boolean |
execute(CommandSender sender,
String commandLabel,
String[] args)
Executes the command, returning its success |
List<String> |
getAliases()
Returns a list of active aliases of this command |
String |
getDescription()
Gets a brief description of this command |
String |
getLabel()
Returns the current lable for this command |
String |
getName()
Returns the name of this command |
String |
getPermission()
Gets the permission required by users to be able to perform this command |
String |
getPermissionMessage()
Returns a message to be displayed on a failed permission check for this command |
String |
getUsage()
Gets an example usage of this command |
boolean |
isRegistered()
Returns the current registered state of this command |
boolean |
register(CommandMap commandMap)
Registers this command to a CommandMap Once called it only allows changes the registered CommandMap |
Command |
setAliases(List<String> aliases)
Sets the list of aliases to request on registration for this command |
Command |
setDescription(String description)
Sets a brief description of this command |
boolean |
setLabel(String name)
Sets the label of this command If the command is currently registered the label change will only take effect after its been reregistered e.g. |
void |
setPermission(String permission)
Sets the permission required by users to be able to perform this command |
Command |
setPermissionMessage(String permissionMessage)
Sets the message sent when a permission check fails |
Command |
setUsage(String usage)
Sets the example usage of this command |
List<String> |
tabComplete(CommandSender sender,
String[] args)
Deprecated. This method is not supported and returns null |
List<String> |
tabComplete(CommandSender sender,
String alias,
String[] args)
Executed on tab completion for this command, returning a list of options the player can tab through. |
boolean |
testPermission(CommandSender target)
Tests the given CommandSender to see if they can perform this command. |
boolean |
testPermissionSilent(CommandSender target)
Tests the given CommandSender to see if they can perform this command. |
String |
toString()
|
boolean |
unregister(CommandMap commandMap)
Unregisters this command from the passed CommandMap applying any outstanding changes |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected String description
protected String usageMessage
Constructor Detail |
---|
protected Command(String name)
protected Command(String name, String description, String usageMessage, List<String> aliases)
Method Detail |
---|
public abstract boolean execute(CommandSender sender, String commandLabel, String[] args)
sender
- Source object which is executing this commandcommandLabel
- The alias of the command usedargs
- All arguments passed to the command, split via ' '
@Deprecated public List<String> tabComplete(CommandSender sender, String[] args)
public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException
sender
- Source object which is executing this commandalias
- the alias being usedargs
- All arguments passed to the command, split via ' '
IllegalArgumentException
- if sender, alias, or args is nullpublic String getName()
public String getPermission()
public void setPermission(String permission)
permission
- Permission name or nullpublic boolean testPermission(CommandSender target)
CommandSender
to see if they can perform this command.
If they do not have permission, they will be informed that they cannot do this.
target
- User to test
public boolean testPermissionSilent(CommandSender target)
CommandSender
to see if they can perform this command.
No error is sent to the sender.
target
- User to test
public String getLabel()
public boolean setLabel(String name)
name
- The command's name
public boolean register(CommandMap commandMap)
commandMap
- the CommandMap to register this command to
public boolean unregister(CommandMap commandMap)
commandMap
- the CommandMap to unregister
public boolean isRegistered()
public List<String> getAliases()
public String getPermissionMessage()
public String getDescription()
public String getUsage()
public Command setAliases(List<String> aliases)
aliases
- Aliases to register to this command
public Command setDescription(String description)
description
- New command description
public Command setPermissionMessage(String permissionMessage)
permissionMessage
- New permission message, null to indicate default message, or an empty string to indicate no message
public Command setUsage(String usage)
usage
- New example usage
public static void broadcastCommandMessage(CommandSender source, String message)
public static void broadcastCommandMessage(CommandSender source, String message, boolean sendToSource)
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |