|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.quartercode.quarterbukkit.api.command.CommandExecutor
public class CommandExecutor
This class is a CommandExecutor
for easy creating commands like /command help 1 without using millions of ifs.
It's easy to use and created for a fast developement progress.
Constructor Summary | |
---|---|
CommandExecutor(org.bukkit.plugin.Plugin plugin,
java.lang.String... commands)
Creates a new CommandExecutor which can be used as Bukkit- CommandExecutor . |
Method Summary | |
---|---|
void |
addCommandHandler(CommandHandler commandHandler)
Registers a CommandHandler . |
boolean |
containsCommandHandler(CommandHandler commandHandler)
Returns if a CommandHandler is registered. |
boolean |
containsCommandHandler(java.lang.String label)
Returns if a CommandHandler with a defined label is registered. |
boolean |
equals(java.lang.Object obj)
|
CommandHandler |
getCommandHandler(java.lang.String label)
Returns the CommandHandler which contains a defined label. |
java.util.List<CommandHandler> |
getCommandHandlers()
Returns all registered command handlers as an unmodifiable list. |
int |
hashCode()
|
boolean |
onCommand(org.bukkit.command.CommandSender sender,
org.bukkit.command.Command command,
java.lang.String label,
java.lang.String[] arguments)
The main method called by the Bukkit-Command-System. |
java.util.List<java.lang.String> |
onTabComplete(org.bukkit.command.CommandSender sender,
org.bukkit.command.Command command,
java.lang.String alias,
java.lang.String[] arguments)
The tab completition method called by the Bukkit-Command-System. |
void |
removeCommandHandler(CommandHandler commandHandler)
Unregisters a CommandHandler . |
void |
removeCommandHandler(java.lang.String label)
Unregisters a CommandHandler which has this label. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CommandExecutor(org.bukkit.plugin.Plugin plugin, java.lang.String... commands)
CommandExecutor
.
It binds the defined commands automatically to this executor.
plugin
- The plugin for the CommandExecutor.commands
- The commands this executor bind to.Method Detail |
---|
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, java.lang.String label, java.lang.String[] arguments)
onCommand
in interface org.bukkit.command.CommandExecutor
sender
- The CommandSender
who executed the command.command
- The Bukkit-Command.label
- The first command label.arguments
- The unparsed (raw) arguments behind the first label (seperated with spaces).
public java.util.List<java.lang.String> onTabComplete(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, java.lang.String alias, java.lang.String[] arguments)
onTabComplete
in interface org.bukkit.command.TabCompleter
sender
- The CommandSender
who executed the command.command
- The Bukkit-Command.alias
- The first command label.arguments
- The unparsed (raw) arguments behind the first label (seperated with spaces).
public java.util.List<CommandHandler> getCommandHandlers()
public CommandHandler getCommandHandler(java.lang.String label)
CommandHandler
which contains a defined label.
Throws an IllegalStateException
if no CommandHandler
with the label is registered.
label
- The command label.
CommandHandler
.public boolean containsCommandHandler(CommandHandler commandHandler)
CommandHandler
is registered.
Use this for checking before other CommandHandler
-functions in this class, like get, register, unregister.
commandHandler
- The CommandHandler
to check.
CommandHandler
is registered.public boolean containsCommandHandler(java.lang.String label)
CommandHandler
with a defined label is registered.
Use this for checking before other CommandHandler
-functions in this class, like get, register, unregister.
label
- The label to check.
CommandHandler
with the label is registered.public void addCommandHandler(CommandHandler commandHandler)
CommandHandler
.
Throws an IllegalStateException
if the CommandHandler
is already registered or there's already a CommandHandler
with a label of the one to register.
commandHandler
- The CommandHandler
to register.public void removeCommandHandler(CommandHandler commandHandler)
CommandHandler
.
Throws an IllegalStateException
if the CommandHandler
isn't registered.
commandHandler
- The CommandHandler
to unregister.public void removeCommandHandler(java.lang.String label)
CommandHandler
which has this label.
Throws an IllegalStateException
if no CommandHandler
with the label is registered.
label
- The CommandHandler
with this label to unregister.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |