Class CommandMessage
Object
CommandMessage
- Author:
- Varun Singh This class adds argument functionality to a given message that a user typed, that also counts as a command
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionString[]getArgs()Separates the given text after the command into an ordered array of argumentsSingles out the text of the message after the commandgetCommandText(boolean includeHandle)
-
Constructor Details
-
CommandMessage
public CommandMessage(Message msg) Constructor for CommandMessage- Parameters:
msg- The message that represents the command that the user typed Preconditions: msg.isCommand() is true msg.hasText() is true Postcondition: The developer has the ability to determine which command the message is executing
-
-
Method Details
-
getMessageText
- Returns:
- the String representation of the message for ease
-
getArgs
Separates the given text after the command into an ordered array of arguments- Returns:
- each argument as a String item in an array
-
getCommandText
- Returns:
- the text of the command WITHOUT the slash For example, if /language English
-
getCommandText
- Returns:
- The text of the message from and including the '/' to the space, which assumes the end of the command name and start of the command arguments
-
getArgsStr
Singles out the text of the message after the command- Returns:
- all the arguments grouped in one string
-