Interface MessageHandler

All Known Implementing Classes:
GameSetupHandler, MotherNatureDestinationHandler, MoveStudentHandler, PlayAssistantCardHandler, PlayCharacterCardHandler, SelectCloudHandler

public interface MessageHandler
The processing of client-side commands by the controller is operated by a message handler entity. This interface encloses a state pattern, which will be implemented by concrete classes.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a help message which lists the possible user actions for the current phase of the game.
    void
    Handles and responds to the specified message received by the client, according to the rules regarding the current phase of the game.
    void
    Plays the specified user's turn according to the rules if they are disconnected and the game is not idle.
    void
    Sends a broadcast update after the specified user's reconnection in order to make sure every player has the information they need in order to play.
  • Method Details

    • handle

      void handle(GameMessage m) throws NoConnectionException
      Handles and responds to the specified message received by the client, according to the rules regarding the current phase of the game.
      Parameters:
      m - the GameMessage received by the client.
      Throws:
      NoConnectionException - if no connection can be retrieved for the sender of the message.
    • getHelp

      String getHelp()
      Returns a help message which lists the possible user actions for the current phase of the game.
      Returns:
      a help message which lists the possible user actions for the current phase of the game.
    • handleDisconnectedUser

      void handleDisconnectedUser(String username)
      Plays the specified user's turn according to the rules if they are disconnected and the game is not idle.
      Parameters:
      username - the disconnected user's username.
    • sendReconnectUpdate

      void sendReconnectUpdate(String username)
      Sends a broadcast update after the specified user's reconnection in order to make sure every player has the information they need in order to play.
      Parameters:
      username - the reconnected user's username.