Bukkit  1.4.7-R1.0
 All Classes Namespaces Files Functions Variables Enumerator Pages
org.bukkit.command.PluginCommand Class Reference

Represents a Command belonging to a plugin. More...

+ Inheritance diagram for org.bukkit.command.PluginCommand:
+ Collaboration diagram for org.bukkit.command.PluginCommand:

Public Member Functions

boolean execute (CommandSender sender, String commandLabel, String[] args)
 Executes the command, returning its success.
 
void setExecutor (CommandExecutor executor)
 Sets the CommandExecutor to run when parsing this command.
 
CommandExecutor getExecutor ()
 Gets the CommandExecutor associated with this command.
 
void setTabCompleter (TabCompleter completer)
 Sets the TabCompleter to run when tab-completing this command.
 
TabCompleter getTabCompleter ()
 Gets the TabCompleter associated with this command.
 
Plugin getPlugin ()
 Gets the owner of this PluginCommand.
 
java.util.List< String > tabComplete (CommandSender sender, String alias, String[] args) throws CommandException, IllegalArgumentException
 

Delegates to the tab completer if present.
 
String toString ()
 
- Public Member Functions inherited from org.bukkit.command.Command
List< String > tabComplete (CommandSender sender, String[] args)
 
List< String > tabComplete (CommandSender sender, String alias, String[] args) throws IllegalArgumentException
 Executed on tab completion for this command, returning a list of options the player can tab through.
 
String getName ()
 Returns the name of this command.
 
String getPermission ()
 Gets the permission required by users to be able to perform this command.
 
void setPermission (String permission)
 Sets the permission required by users to be able to perform this command.
 
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 getLabel ()
 Returns the current lable for 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.
 
boolean register (CommandMap commandMap)
 Registers this command to a CommandMap Once called it only allows changes the registered CommandMap.
 
boolean unregister (CommandMap commandMap)
 Unregisters this command from the passed CommandMap applying any outstanding changes.
 
boolean isRegistered ()
 Returns the current registered state of this command.
 
List< String > getAliases ()
 Returns a list of active aliases of this command.
 
String getPermissionMessage ()
 Returns a message to be displayed on a failed permission check for this command.
 
String getDescription ()
 Gets a brief description of this command.
 
String getUsage ()
 Gets an example usage of this command.
 
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.
 
Command setPermissionMessage (String permissionMessage)
 Sets the message sent when a permission check fails.
 
Command setUsage (String usage)
 Sets the example usage of this command.
 
String toString ()
 
- Public Member Functions inherited from org.bukkit.command.PluginIdentifiableCommand
Plugin getPlugin ()
 Gets the owner of this PluginIdentifiableCommand.
 

Protected Member Functions

 PluginCommand (String name, Plugin owner)
 
- Protected Member Functions inherited from org.bukkit.command.Command
 Command (String name)
 
 Command (String name, String description, String usageMessage, List< String > aliases)
 

Additional Inherited Members

- Static Public Member Functions inherited from org.bukkit.command.Command
static void broadcastCommandMessage (CommandSender source, String message)
 
static void broadcastCommandMessage (CommandSender source, String message, boolean sendToSource)
 
- Protected Attributes inherited from org.bukkit.command.Command
String description = ""
 
String usageMessage
 

Detailed Description

Represents a Command belonging to a plugin.

Definition at line 11 of file PluginCommand.java.

Constructor & Destructor Documentation

org.bukkit.command.PluginCommand.PluginCommand ( String  name,
Plugin  owner 
)
protected

Definition at line 16 of file PluginCommand.java.

References org.bukkit.command.Command.usageMessage.

Member Function Documentation

boolean org.bukkit.command.PluginCommand.execute ( CommandSender  sender,
String  commandLabel,
String[]  args 
)
virtual

Executes the command, returning its success.

Parameters
senderSource object which is executing this command
commandLabelThe alias of the command used
argsAll arguments passed to the command, split via ' '
Returns
true if the command was successful, otherwise false

Implements org.bukkit.command.Command.

Definition at line 32 of file PluginCommand.java.

References org.bukkit.plugin.Plugin.getDescription(), org.bukkit.plugin.PluginDescriptionFile.getFullName(), org.bukkit.plugin.Plugin.isEnabled(), org.bukkit.command.CommandExecutor.onCommand(), org.bukkit.command.CommandSender.sendMessage(), org.bukkit.command.Command.testPermission(), and org.bukkit.command.Command.usageMessage.

CommandExecutor org.bukkit.command.PluginCommand.getExecutor ( )

Gets the CommandExecutor associated with this command.

Returns
CommandExecutor object linked to this command

Definition at line 72 of file PluginCommand.java.

Plugin org.bukkit.command.PluginCommand.getPlugin ( )

Gets the owner of this PluginCommand.

Returns
Plugin that owns this command

Definition at line 101 of file PluginCommand.java.

Referenced by org.bukkit.plugin.java.JavaPlugin.getCommand().

TabCompleter org.bukkit.command.PluginCommand.getTabCompleter ( )

Gets the TabCompleter associated with this command.

Returns
TabCompleter object linked to this command

Definition at line 92 of file PluginCommand.java.

void org.bukkit.command.PluginCommand.setExecutor ( CommandExecutor  executor)

Sets the CommandExecutor to run when parsing this command.

Parameters
executorNew executor to run

Definition at line 63 of file PluginCommand.java.

void org.bukkit.command.PluginCommand.setTabCompleter ( TabCompleter  completer)

Sets the TabCompleter to run when tab-completing this command.

If no TabCompleter is specified, and the command's executor implements TabCompleter, then the executor will be used for tab completion.

Parameters
completerNew tab completer

Definition at line 83 of file PluginCommand.java.

java.util.List<String> org.bukkit.command.PluginCommand.tabComplete ( CommandSender  sender,
String  alias,
String[]  args 
) throws CommandException, IllegalArgumentException



Delegates to the tab completer if present.


If it is not present or returns null, will delegate to the current command executor if it implements TabCompleter. If a non-null list has not been found, will default to standard player name completion in Command#tabComplete(CommandSender, String, String[]).

This method does not consider permissions.

Exceptions
CommandExceptionif the completer or executor throw an exception during the process of tab-completing.
IllegalArgumentExceptionif sender, alias, or args is null

Definition at line 119 of file PluginCommand.java.

References org.bukkit.plugin.Plugin.getDescription(), org.bukkit.plugin.PluginDescriptionFile.getFullName(), and org.bukkit.command.TabCompleter.onTabComplete().

String org.bukkit.command.PluginCommand.toString ( )

The documentation for this class was generated from the following file: