|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.lib.commands.PutCommand
This class implements "put" - for putting things in containers.
Nested Class Summary | |
class |
PutCommand.PutEvent
This class encapsulates the parameters for a Put event. |
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 e)
Creates a PutEvent from the original event. |
boolean |
execute(CommandEvent e)
Executes the specified CommandEvent. |
Bag |
findBag(Commandable agent,
PutCommand.PutEvent event,
java.lang.String desc)
Looks for the destination bag, first in inventory, then on the ground beneath the player. |
static PutCommand |
getImpl()
|
boolean |
knowsCommand(java.lang.String command)
Returns true if this Command wants to handle the command. |
void |
parseArgs(PutCommand.PutEvent event)
Tries to parse a direct and indirect object from the arguments. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static PutCommand getImpl()
public void addCommands(java.util.Map commands, CommandList list)
BuiltInCommand
addCommands
in interface BuiltInCommand
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.public boolean knowsCommand(java.lang.String command)
Command
This method exists to allow more than one game object to implement the same command verb, but with different expected arguments.
If two objects register for the same command and the same arguments, the object that was registered most recently gets to handle at the command.
knowsCommand
in interface Command
command
- the entire command string, including arguments
public CommandEvent createEvent(CommandEvent e)
createEvent
in interface Command
e
- 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).
public void parseArgs(PutCommand.PutEvent event)
event
- the event containing the command argspublic Bag findBag(Commandable agent, PutCommand.PutEvent event, java.lang.String desc)
agent
- the agentevent
- the eventdesc
- the indirect object of the command
public boolean execute(CommandEvent e)
Command
execute
in interface Command
e
- the CommandEvent to execute
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |