|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This object stores Commands. All game commands (built-in or add-on) are implemented by Command objects. A Command registers itself with a particular agent (e.g. player or monster) so that the agent can execute the command implemented by the Command. Upon registering, the Command is stored in a table managed by this class.
Command
Nested Class Summary | |
static interface |
CommandList.CommandFilter
This interface is implemented by classes that want a chance to handle *every* command that comes through the queue. |
Method Summary | |
void |
addFilter(CommandList.CommandFilter obj)
Adds a filter object (a Command wanting to get the opportunity to handle all commands that come through) to the list. |
void |
addWizBuiltins()
Put built-in commands just for Wizards into the dictionary. |
Command |
findHandler(CommandEvent event)
Finds an object to handle the specified command. |
Commandable |
getCommandable()
Returns the Commandable (usually a Player) that this list is associated with. |
java.util.Map |
getCommandMap()
Returns the MultiHashMap mapping commands to handlers. |
java.lang.String[] |
getCommands()
Returns a list of all the commands in this list. |
Command[] |
getRegisteredCommands(java.lang.String verb)
Returns the registered commands for the given Command handler. |
void |
registerCommand(java.lang.String command,
Command handler)
Registers a new command command. |
void |
reload()
Reloads all the built-in command handlers. |
void |
removeFilter(CommandList.CommandFilter obj)
Called by a Command when it wants to get off the list for being requested about handling every command. |
void |
unregisterCommand(java.lang.String command,
Command handler)
Unregisters a command. |
Method Detail |
public void addFilter(CommandList.CommandFilter obj)
obj
- a filterpublic void removeFilter(CommandList.CommandFilter obj)
obj
- the filter to removepublic Command findHandler(CommandEvent event)
event
- the CommandEvent containing the command
public void registerCommand(java.lang.String command, Command handler)
The new command will go at the front of the list of handlers for the command. I.e. the most recently-added command gets first shot at the command.
command
- the command verb to registerhandler
- the Command object that implements the commandpublic void unregisterCommand(java.lang.String command, Command handler)
command
- the command verb to registerhandler
- the Command object that implements the commandpublic Commandable getCommandable()
public java.lang.String[] getCommands()
public Command[] getRegisteredCommands(java.lang.String verb)
verb
- a command verb
public void addWizBuiltins()
public java.util.Map getCommandMap()
public void reload()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |