The command parser. Handles listening for user input, searching for a valid command and invoking that command.

package: parser;

Contents

Methods

static ArrayList getCommandList()

Returns a list of all of the Commands for which the parser is listening.

static ArrayList getOptions()

Returns a list of all of the Conversation options for which the parser is listening.
The parser will take care of adding and removing conversation options automatically.

static String getPrompt()

Returns the command prompt string.

static void addCommand(Command c)

Adds a Command for which the parser will listen and invoke.

static boolean removeCommand(Command c)

Returns true if Command c has been successfully removed. False otherwise.

static void clearConversationOptions()

Removes all of the Conversation options for which the parser is currently listening. This is handled automatically, but can be called manually as well.

static void setPrompt(String p)

Set the prompt with which the Player is presented.

static void listen(Player p, Map m)

The magic of the parser! Accepts one line of input from the user and tries to parse it to run a valid Command. Must pass in a valid Player and Map in order for commands to be invoked correctly.