wyvern.lib.commands
Class GetFromCommand
java.lang.Object
wyvern.lib.commands.GetFromCommand
- All Implemented Interfaces:
- BuiltInCommand, Command
- public class GetFromCommand
- extends java.lang.Object
- implements BuiltInCommand
This Command handles "get from " - e.g. pulling an
item from a bag.
- Version:
- 1.0, Jun 16, 1998
- Author:
- Steve Yegge
Method Summary |
void |
addCommands(java.util.Map commands,
CommandList list)
Tells the Command to add the commands that it wants to
implement into the passed data structure. |
CommandEvent |
createEvent(CommandEvent initial)
Creates a CommandEvent that encapsulates all the state
necessary to perform the command. |
boolean |
execute(CommandEvent ev)
Implements Command.execute |
static GetFromCommand |
getImpl()
|
boolean |
knowsCommand(java.lang.String command)
This command only handle removing things from containers; the
PickupCommand handles the other kind of "get". |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
getImpl
public static GetFromCommand getImpl()
addCommands
public void addCommands(java.util.Map commands,
CommandList list)
- Description copied from interface:
BuiltInCommand
- Tells the Command to add the commands that it wants to
implement into the passed data structure.
- Specified by:
addCommands
in interface BuiltInCommand
- Parameters:
commands
- a Map whose keys are commands, and whose values
are Commands that handle those commands.list
- the CommandList the Command is being added to.
knowsCommand
public boolean knowsCommand(java.lang.String command)
- This command only handle removing things from containers; the
PickupCommand handles the other kind of "get".
- Specified by:
knowsCommand
in interface Command
- Parameters:
command
- the entire command string, including arguments
- Returns:
- true if we want to handle the command
createEvent
public CommandEvent createEvent(CommandEvent initial)
- Description copied from interface:
Command
- Creates a CommandEvent that encapsulates all the state
necessary to perform the command. A well-designed CommandEvent
exposes all of its "properties" so that hook objects can
modify its behavior. For instance, many commands result in
some sort of message being sent back to the client. The
message should be among the properties that hooks can override.
This method is called by the kernel. The kernel passes the
event to the pre-hook, then calls Command.execute() (below)
to execute the event, and finally calls the post-hook.
- Specified by:
createEvent
in interface Command
- Parameters:
initial
- a "blank" CommandEvent containing only the
command text and the agent who's performing the command. This
initial event is created by the originator of the event (e.g.
the AI or player's command preprocessor).
- Returns:
- a CommandEvent subclass encapsulating this command's
execution parameters and state. It should copy in the fields
from the passed-in event.
execute
public boolean execute(CommandEvent ev)
- Implements Command.execute
- Specified by:
execute
in interface Command
- Parameters:
ev
- the GetFromEvent to execute
- Returns:
- true if it executed successfully