Interface NetworkHandler

All Known Implementing Classes:
NetworkHandlerRMI, NetworkHandlerSocket

public interface NetworkHandler
This is the interface used by the client to communicate with the server. Aside from getPlayer, all the methods are processed on the server
  • Method Details

    • getPlayer

      PlayerLobby getPlayer()
      Returns:
      The current valid player associated to this NetworkHandler. Null is no valid player is currently associated.
    • getRooms

      void getRooms()
      Get the existing rooms
    • createRoom

      void createRoom(String nickname, Token token, int nPlayers)
      Create a room with the passed parameters
      Parameters:
      nickname - of the player who is creating the room
      token - of the player who is creating the room
      nPlayers - of the room that is being created
    • joinRoom

      void joinRoom(String nickname, Token token, int gameId)
      Make the player join the specified room
      Parameters:
      nickname - the nickname the client wants to join the room with
      token - chosen by the player who wants to join the room
      gameId - of the game that the client wants to join
    • reconnect

      void reconnect(String nickname, Token token)
      Reconnect the passed player to an existing game he was previously part of
      Parameters:
      nickname - of the player who wants to reconnect
      token - of the player who wants to reconnect
    • leaveRoom

      void leaveRoom()
      Make the player leave the room he is currently part of
    • playStarter

      void playStarter(Side side)
      Play the starter card
      Parameters:
      side - on which the starter card should be played
    • choosePersonalObjective

      void choosePersonalObjective(CardObjectiveIF card)
      Choose the personal objective card
      Parameters:
      card - the chosen personal objective
    • playCard

      void playCard(CardPlayableIF card, Coordinates coords, Side side)
      Play a card according to the parameters
      Parameters:
      card - the player wants to play
      coords - where the card should be played
      side - on which the card should be played
    • pickCard

      void pickCard(CardPlayableIF card)
      Pick the passed card
      Parameters:
      card - the player wants to pick
    • startPing

      void startPing()
      Starts the thread sending pings to server
    • stopPing

      void stopPing()
      Stops the thread sending pings to server
    • sendChatMessage

      void sendChatMessage(List<PlayerLobby> receivers, String text)
      Send a chat message to the receivers (either a single player, or all the other players)
      Parameters:
      receivers - of the chat message
      text - of the chat message