Class EmotionToCommand

All Implemented Interfaces:
Command

public class EmotionToCommand extends TargetCommand
Provides an emotional response to a person. Acceptable format is: [emotion] to [person]

For example:

  • lick Karn
  • nudge Westril
Author:
maartenl
  • Constructor Details

    • EmotionToCommand

      public EmotionToCommand(String aRegExpr)
  • Method Details

    • actionTo

      protected DisplayInterface actionTo(User aUser, Person aTarget, String verb, String command) throws MudException
      Description copied from class: TargetCommand
      Run the action command to a target.
      Specified by:
      actionTo in class TargetCommand
      Parameters:
      aUser - the one executing the command
      aTarget - the target of the command
      verb - the verb, usually the first word in the command, for example "cheer".
      command - the rest of the command, for example "bow to Marvin evilly", will provide "evilly". But "bow to Marvin" will return a null pointer.
      Returns:
      something to display
      Throws:
      MudException
    • action

      protected DisplayInterface action(User aUser, String verb, String command) throws MudException
      Description copied from class: TargetCommand
      Run an action without a target.
      Specified by:
      action in class TargetCommand
      Parameters:
      aUser - the one executing the command
      verb - the verb, usually the first word in the command, for example "bow".
      command - the rest of the command, for example "bow evilly" would return "evilly". "bow" would return null.
      Returns:
      something to display
      Throws:
      MudException
    • getTarget

      protected Person getTarget(String[] myParsed, User aUser) throws PersonNotFoundException
      Retrieves a target from the command line, detected in the form of "[command] [target] stuff". For example "cuddle Karn".
      Overrides:
      getTarget in class TargetCommand
      Parameters:
      myParsed - the command, parsed. Usually only needs the first two words.
      aUser - the user issuing the command
      Returns:
      the Person found, null if no person in the command.
      Throws:
      PersonNotFoundException - if the person is not found in the room.