Class ClientEventAdapter

java.lang.Object
io.sockit.gameclient.ClientEventAdapter
All Implemented Interfaces:
ClientEventListener

public abstract class ClientEventAdapter
extends Object
implements ClientEventListener
An abstract adapter class for receiving client events. The methods in this class are empty. This class exists as convenience for creating ClientEventListener objects.
  • Constructor Details

  • Method Details

    • beforeServerMessageProcessed

      public void beforeServerMessageProcessed​(Client client, ServerMessageType serverMessageType, String customMessageCommand, boolean isBinary, Object data)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when a message is received from the Server but before it is processed
      Specified by:
      beforeServerMessageProcessed in interface ClientEventListener
      Parameters:
      client - - the Client which received the message
      serverMessageType - - the messageType received from Server e.g. ServerMessageType.roomJoined or ServerMessageType.gamePlayStarted or ...
      customMessageCommand - - the custom message command if the serverMessageType is a custom message
      isBinary - - whether message data is binary or not
      data - - the message data
    • afterServerMessageProcessed

      public void afterServerMessageProcessed​(Client client, ServerMessageType serverMessageType, String customMessageCommand, boolean isBinary, Object data)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when a message is received from the Server but after it is processed
      Specified by:
      afterServerMessageProcessed in interface ClientEventListener
      Parameters:
      client - - the Client which received the message
      serverMessageType - - the messageType received from Server e.g. ServerMessageType.roomJoined or ServerMessageType.gamePlayStarted or ...
      customMessageCommand - - the custom message command if the serverMessageType is a custom message
      isBinary - - whether message data is binary or not
      data - - the message data
    • onError

      public void onError​(Client client, int errorCode, String errorDesc)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when an error is triggered on the server.
      Specified by:
      onError in interface ClientEventListener
      Parameters:
      client - - the Client which triggered the error
      errorCode - - the errorCode e.g. ErrorCodes.emailIdAndPasswordDoesNotMatch or ErrorCodes.seatNotFree or ...
      errorDesc - - the error description
    • onLoggedIn

      public void onLoggedIn​(Client client, boolean isGameSelected)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when the Client successfully logins a user into the server
      Specified by:
      onLoggedIn in interface ClientEventListener
      Parameters:
      client - - the Client which loggedIn
      isGameSelected - - whether a Game is linked with this user session or not
    • onLoggedOut

      public void onLoggedOut​(Client client)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when the Client successfully logouts a user from the server
      Specified by:
      onLoggedOut in interface ClientEventListener
      Parameters:
      client - - the client which loggedOut
    • onSessionTimedOut

      public void onSessionTimedOut​(Client client)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when the Client session times out on the server
      Specified by:
      onSessionTimedOut in interface ClientEventListener
      Parameters:
      client - - the client whose session timed out
    • onServerShutdown

      public void onServerShutdown​(Client client)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when the server shutsdown
      Specified by:
      onServerShutdown in interface ClientEventListener
      Parameters:
      client - - the Client which triggered this event
    • onGetLocations

      public void onGetLocations​(Client client, String gameName, List<String> locations)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when the Client receives the location list from the Server
      Specified by:
      onGetLocations in interface ClientEventListener
      Parameters:
      client - - the Client which triggered this event
      gameName - - the name of the game whose locations were requested by the Client
      locations - - the list of locations
    • onGetRooms

      public void onGetRooms​(Client client, String gameName, String location, RoomType roomtype, List<RoomInfo> rooms)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when the Client receives the room list from the Server
      Specified by:
      onGetRooms in interface ClientEventListener
      Parameters:
      client - - the Client which triggered this event
      gameName - - the name of the game whose room list was requested by the Client
      location - - the location whose room list was requested
      roomtype - - the type of room list e.g. RoomType.normal or RoomType.fast
      rooms - - the room list as a collection of RoomInfo objects
    • onRoomJoined

      public void onRoomJoined​(Client client, Room room)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when the Client joins a room
      Specified by:
      onRoomJoined in interface ClientEventListener
      Parameters:
      client - - the Client which triggered this event
      room - - the room joined by this Client
    • onRoomRefreshedFromServer

      public void onRoomRefreshedFromServer​(Client client, Room room)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when the room state is refreshed from the server. Gets triggered when Client receives a ServerMessageType.roomData message from the Server
      Specified by:
      onRoomRefreshedFromServer in interface ClientEventListener
      Parameters:
      client - - the Client which triggered this event
      room - - the room joined by the client
    • onSeatTaken

      public void onSeatTaken​(Client client, Player playerSeated, Room room, boolean isSelf)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when any user takes a seat in the room.
      Specified by:
      onSeatTaken in interface ClientEventListener
      Parameters:
      client - - the Client which receives this event
      playerSeated - - the player which took seat
      room - - the room joined by this client
      isSelf - - if the user seated is the same as this Client
    • onSeatLeft

      public void onSeatLeft​(Client client, Player playerLeft, Room room, boolean isSelf)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when any user leaves a seat in the room.
      Specified by:
      onSeatLeft in interface ClientEventListener
      Parameters:
      client - - the Client which receives this event
      playerLeft - - the player which left the seat
      room - - the room joined by this client
      isSelf - - if the user which left is the same as this Client
    • onRoomLeft

      public void onRoomLeft​(Client client)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when the Client leaves the room
      Specified by:
      onRoomLeft in interface ClientEventListener
      Parameters:
      client - - the Client which triggered this event
    • onMessageReceivedJson

      public void onMessageReceivedJson​(Client client, String command, JsonObject data)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when the Client receives a custom Json message from the server
      Specified by:
      onMessageReceivedJson in interface ClientEventListener
      Parameters:
      client - - the Client which receives the message
      command - - the message command
      data - - the message data as json
    • onMessageReceivedString

      public void onMessageReceivedString​(Client client, String command, String data)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when the Client receives a custom text message from the server
      Specified by:
      onMessageReceivedString in interface ClientEventListener
      Parameters:
      client - - the Client which receives the message
      command - - the message command
      data - - the message data as String
    • onMessageReceivedBytes

      public void onMessageReceivedBytes​(Client client, String command, byte[] data)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when the Client receives a custom binary message from the server
      Specified by:
      onMessageReceivedBytes in interface ClientEventListener
      Parameters:
      client - - the Client which receives the message
      command - - the message command
      data - - the message data as a byte array
    • onGamePlayStarted

      public void onGamePlayStarted​(Client client, Room room)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when game play starts in the room
      Specified by:
      onGamePlayStarted in interface ClientEventListener
      Parameters:
      client - - the Client which receives this event
      room - - the room joined by this client
    • onNextTurn

      public void onNextTurn​(Client client, Player turnPlayer, JsonObject turnData, Room room, boolean isSelfTurn)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when a new turn begins
      Specified by:
      onNextTurn in interface ClientEventListener
      Parameters:
      client - - the Client which receives this event
      turnPlayer - - the player whose turn it is
      turnData - - the additional data received with the event. For e.g. in a game like Poker it could be {"callValue":20}
      room - - the room joined by this client
      isSelfTurn - - whether its the turn of the client which received this event
    • onTurnPlayed

      public void onTurnPlayed​(Client client, Player turnPlayer, String playerAction, JsonObject actionData, Room room, boolean isSelf)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when a player plays his/her turn
      Specified by:
      onTurnPlayed in interface ClientEventListener
      Parameters:
      client - - the Client which receives this event
      turnPlayer - - the player who played the action
      playerAction - - the action played by the player
      actionData - - the action data if any. For e.g. in a game like Poker it could be {"amtBet":20}
      room - - the room joined by this client
      isSelf - - whether the action was played by the client which received this event
    • onOutOfTurnPlayed

      public void onOutOfTurnPlayed​(Client client, Player outOfTurnPlayer, String playerAction, JsonObject actionData, Room room, boolean isSelf)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when an action is played out of turn by a player
      Specified by:
      onOutOfTurnPlayed in interface ClientEventListener
      Parameters:
      client - - the Client which receives this event
      outOfTurnPlayer - - the player who played the action
      playerAction - - the action played by the player
      actionData - - the action data if any.
      room - - the room joined by this client
      isSelf - - whether the action was played by the client which received this event
    • onGameAction

      public void onGameAction​(Client client, String gameAction, JsonObject actionData, Room room)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when a game action occurs in the game. For e.f. in a game like poker this could be flop cards dealt
      Specified by:
      onGameAction in interface ClientEventListener
      Parameters:
      client - - the Client which receives this event
      gameAction - - the game action
      actionData - - the action data. For e.g. in a game like poker this could be the value of the flop cards
      room - - the room joined by this client
    • onGamePlayEnded

      public void onGamePlayEnded​(Client client, Room room, JsonObject endGameData)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when game play ends in the room
      Specified by:
      onGamePlayEnded in interface ClientEventListener
      Parameters:
      client - - the Client which receives this event
      room - - the room joined by this client
      endGameData - - the data received with the endGame event. For e.g this could be the winning seat no and the amount won
    • onRoomDestroyed

      public void onRoomDestroyed​(Client client, Room room)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when the room joined by this client is destroyed
      Specified by:
      onRoomDestroyed in interface ClientEventListener
      Parameters:
      client - - the Client which receives this event
      room - - the room which was destroyed
    • onAvtarChangedOfSelf

      public void onAvtarChangedOfSelf​(Client client, int newAvtarId)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when the avtar of the user loggedIn via this client changes
      Specified by:
      onAvtarChangedOfSelf in interface ClientEventListener
      Parameters:
      client - - the Client which receives this event
      newAvtarId - - the new avtarId of the user
    • onAvtarChangedOfOtherPlayer

      public void onAvtarChangedOfOtherPlayer​(Client client, Player player, int newAvtarId, Room room)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when the avtar of another player is changed
      Specified by:
      onAvtarChangedOfOtherPlayer in interface ClientEventListener
      Parameters:
      client - - the Client which receives this event
      player - - the player whose avtar is changed
      newAvtarId - - the new avtarID
      room - - the room joined by this client
    • onNotEligibleToPlay

      public void onNotEligibleToPlay​(Client client, Player player, Room room, String reason)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when the Client is not eligible to play the new game play that is starting
      Specified by:
      onNotEligibleToPlay in interface ClientEventListener
      Parameters:
      client - - the Client which receives this event
      player - - the player linked to this client
      room - - the room joined by this client
      reason - - the reason why player is not eligible
    • onSessionRejoined

      public void onSessionRejoined​(Client client)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when session is rejoined by this client. This event is triggered by the method Client.rejoinSession()
      Specified by:
      onSessionRejoined in interface ClientEventListener
      Parameters:
      client - - the Client which receives this event
    • onConnecting

      public void onConnecting​(Client client)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when Client is attempting to connect to the server
      Specified by:
      onConnecting in interface ClientEventListener
      Parameters:
      client - - the Client which triggers this event
    • onConnectionSuccess

      public void onConnectionSuccess​(Client client)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when Client is successfully connected to the server
      Specified by:
      onConnectionSuccess in interface ClientEventListener
      Parameters:
      client - - the Client which triggers this event
    • onConnectionFailure

      public void onConnectionFailure​(Client client)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when Client is fails to connect to the server
      Specified by:
      onConnectionFailure in interface ClientEventListener
      Parameters:
      client - - the Client which triggers this event
    • onConnectionDisconnected

      public void onConnectionDisconnected​(Client client)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when Client is disconnected from the server i.e. When the Server initiates the connection close.
      Specified by:
      onConnectionDisconnected in interface ClientEventListener
      Parameters:
      client - - the Client which triggers this event
    • onConnectionClosed

      public void onConnectionClosed​(Client client)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when the connection to the server is closed i.e. When the Client initiates the connection close.
      Specified by:
      onConnectionClosed in interface ClientEventListener
      Parameters:
      client - - the Client which triggers this event
    • onInvalidAction

      public void onInvalidAction​(Client client, String action, String description, JsonObject errorData, Room room, boolean isOutOfTurn)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when an action played by the Client is not valid
      Specified by:
      onInvalidAction in interface ClientEventListener
      Parameters:
      client - - the Client which triggers this event
      action - - the action played
      description - - the error description
      errorData - - the error data containing more info about the error
      room - - the room joined by the client
      isOutOfTurn - - true if the action was played out of turn
    • onEnterGame

      public void onEnterGame​(Client client, String gameName)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when Client enters/selects a game.
      Specified by:
      onEnterGame in interface ClientEventListener
      Parameters:
      client - - the Client which triggers this event
      gameName - - the name of the game entered/selected
    • onExitGame

      public void onExitGame​(Client client, String gameName)
      Description copied from interface: ClientEventListener
      Event-Handler/Callback called when Client exits/deselects a game.
      Specified by:
      onExitGame in interface ClientEventListener
      Parameters:
      client - - the Client which triggers this event
      gameName - - the name of the game exited/deselected