Package io.sockit.gameclient
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 Summary
Constructors Constructor Description ClientEventAdapter()
-
Method Summary
Modifier and Type Method Description void
afterServerMessageProcessed(Client client, ServerMessageType serverMessageType, String customMessageCommand, boolean isBinary, Object data)
Event-Handler/Callback called when a message is received from the Server but after it is processedvoid
beforeServerMessageProcessed(Client client, ServerMessageType serverMessageType, String customMessageCommand, boolean isBinary, Object data)
Event-Handler/Callback called when a message is received from the Server but before it is processedvoid
onAvtarChangedOfOtherPlayer(Client client, Player player, int newAvtarId, Room room)
Event-Handler/Callback called when the avtar of another player is changedvoid
onAvtarChangedOfSelf(Client client, int newAvtarId)
Event-Handler/Callback called when the avtar of the user loggedIn via this client changesvoid
onConnecting(Client client)
Event-Handler/Callback called when Client is attempting to connect to the servervoid
onConnectionClosed(Client client)
Event-Handler/Callback called when the connection to the server is closed i.e.void
onConnectionDisconnected(Client client)
Event-Handler/Callback called when Client is disconnected from the server i.e.void
onConnectionFailure(Client client)
Event-Handler/Callback called when Client is fails to connect to the servervoid
onConnectionSuccess(Client client)
Event-Handler/Callback called when Client is successfully connected to the servervoid
onEnterGame(Client client, String gameName)
Event-Handler/Callback called when Client enters/selects a game.void
onError(Client client, int errorCode, String errorDesc)
Event-Handler/Callback called when an error is triggered on the server.void
onExitGame(Client client, String gameName)
Event-Handler/Callback called when Client exits/deselects a game.void
onGameAction(Client client, String gameAction, JsonObject actionData, Room room)
Event-Handler/Callback called when a game action occurs in the game.void
onGamePlayEnded(Client client, Room room, JsonObject endGameData)
Event-Handler/Callback called when game play ends in the roomvoid
onGamePlayStarted(Client client, Room room)
Event-Handler/Callback called when game play starts in the roomvoid
onGetLocations(Client client, String gameName, List<String> locations)
Event-Handler/Callback called when the Client receives the location list from the Servervoid
onGetRooms(Client client, String gameName, String location, RoomType roomtype, List<RoomInfo> rooms)
Event-Handler/Callback called when the Client receives the room list from the Servervoid
onInvalidAction(Client client, String action, String description, JsonObject errorData, Room room, boolean isOutOfTurn)
Event-Handler/Callback called when an action played by the Client is not validvoid
onLoggedIn(Client client, boolean isGameSelected)
Event-Handler/Callback called when the Client successfully logins a user into the servervoid
onLoggedOut(Client client)
Event-Handler/Callback called when the Client successfully logouts a user from the servervoid
onMessageReceivedBytes(Client client, String command, byte[] data)
Event-Handler/Callback called when the Client receives a custom binary message from the servervoid
onMessageReceivedJson(Client client, String command, JsonObject data)
Event-Handler/Callback called when the Client receives a custom Json message from the servervoid
onMessageReceivedString(Client client, String command, String data)
Event-Handler/Callback called when the Client receives a custom text message from the servervoid
onNextTurn(Client client, Player turnPlayer, JsonObject turnData, Room room, boolean isSelfTurn)
Event-Handler/Callback called when a new turn beginsvoid
onNotEligibleToPlay(Client client, Player player, Room room, String reason)
Event-Handler/Callback called when the Client is not eligible to play the new game play that is startingvoid
onOutOfTurnPlayed(Client client, Player outOfTurnPlayer, String playerAction, JsonObject actionData, Room room, boolean isSelf)
Event-Handler/Callback called when an action is played out of turn by a playervoid
onRoomDestroyed(Client client, Room room)
Event-Handler/Callback called when the room joined by this client is destroyedvoid
onRoomJoined(Client client, Room room)
Event-Handler/Callback called when the Client joins a roomvoid
onRoomLeft(Client client)
Event-Handler/Callback called when the Client leaves the roomvoid
onRoomRefreshedFromServer(Client client, Room room)
Event-Handler/Callback called when the room state is refreshed from the server.void
onSeatLeft(Client client, Player playerLeft, Room room, boolean isSelf)
Event-Handler/Callback called when any user leaves a seat in the room.void
onSeatTaken(Client client, Player playerSeated, Room room, boolean isSelf)
Event-Handler/Callback called when any user takes a seat in the room.void
onServerShutdown(Client client)
Event-Handler/Callback called when the server shutsdownvoid
onSessionRejoined(Client client)
Event-Handler/Callback called when session is rejoined by this client.void
onSessionTimedOut(Client client)
Event-Handler/Callback called when the Client session times out on the servervoid
onTurnPlayed(Client client, Player turnPlayer, String playerAction, JsonObject actionData, Room room, boolean isSelf)
Event-Handler/Callback called when a player plays his/her turn
-
Constructor Details
-
ClientEventAdapter
public ClientEventAdapter()
-
-
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 interfaceClientEventListener
- Parameters:
client
- - the Client which received the messageserverMessageType
- - the messageType received from Server e.g. ServerMessageType.roomJoined or ServerMessageType.gamePlayStarted or ...customMessageCommand
- - the custom message command if the serverMessageType is a custom messageisBinary
- - whether message data is binary or notdata
- - 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 interfaceClientEventListener
- Parameters:
client
- - the Client which received the messageserverMessageType
- - the messageType received from Server e.g. ServerMessageType.roomJoined or ServerMessageType.gamePlayStarted or ...customMessageCommand
- - the custom message command if the serverMessageType is a custom messageisBinary
- - whether message data is binary or notdata
- - the message data
-
onError
Description copied from interface:ClientEventListener
Event-Handler/Callback called when an error is triggered on the server.- Specified by:
onError
in interfaceClientEventListener
- Parameters:
client
- - the Client which triggered the errorerrorCode
- - the errorCode e.g. ErrorCodes.emailIdAndPasswordDoesNotMatch or ErrorCodes.seatNotFree or ...errorDesc
- - the error description
-
onLoggedIn
Description copied from interface:ClientEventListener
Event-Handler/Callback called when the Client successfully logins a user into the server- Specified by:
onLoggedIn
in interfaceClientEventListener
- Parameters:
client
- - the Client which loggedInisGameSelected
- - whether a Game is linked with this user session or not
-
onLoggedOut
Description copied from interface:ClientEventListener
Event-Handler/Callback called when the Client successfully logouts a user from the server- Specified by:
onLoggedOut
in interfaceClientEventListener
- Parameters:
client
- - the client which loggedOut
-
onSessionTimedOut
Description copied from interface:ClientEventListener
Event-Handler/Callback called when the Client session times out on the server- Specified by:
onSessionTimedOut
in interfaceClientEventListener
- Parameters:
client
- - the client whose session timed out
-
onServerShutdown
Description copied from interface:ClientEventListener
Event-Handler/Callback called when the server shutsdown- Specified by:
onServerShutdown
in interfaceClientEventListener
- Parameters:
client
- - the Client which triggered this event
-
onGetLocations
Description copied from interface:ClientEventListener
Event-Handler/Callback called when the Client receives the location list from the Server- Specified by:
onGetLocations
in interfaceClientEventListener
- Parameters:
client
- - the Client which triggered this eventgameName
- - the name of the game whose locations were requested by the Clientlocations
- - 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 interfaceClientEventListener
- Parameters:
client
- - the Client which triggered this eventgameName
- - the name of the game whose room list was requested by the Clientlocation
- - the location whose room list was requestedroomtype
- - the type of room list e.g. RoomType.normal or RoomType.fastrooms
- - the room list as a collection of RoomInfo objects
-
onRoomJoined
Description copied from interface:ClientEventListener
Event-Handler/Callback called when the Client joins a room- Specified by:
onRoomJoined
in interfaceClientEventListener
- Parameters:
client
- - the Client which triggered this eventroom
- - the room joined by this Client
-
onRoomRefreshedFromServer
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 interfaceClientEventListener
- Parameters:
client
- - the Client which triggered this eventroom
- - the room joined by the client
-
onSeatTaken
Description copied from interface:ClientEventListener
Event-Handler/Callback called when any user takes a seat in the room.- Specified by:
onSeatTaken
in interfaceClientEventListener
- Parameters:
client
- - the Client which receives this eventplayerSeated
- - the player which took seatroom
- - the room joined by this clientisSelf
- - if the user seated is the same as this Client
-
onSeatLeft
Description copied from interface:ClientEventListener
Event-Handler/Callback called when any user leaves a seat in the room.- Specified by:
onSeatLeft
in interfaceClientEventListener
- Parameters:
client
- - the Client which receives this eventplayerLeft
- - the player which left the seatroom
- - the room joined by this clientisSelf
- - if the user which left is the same as this Client
-
onRoomLeft
Description copied from interface:ClientEventListener
Event-Handler/Callback called when the Client leaves the room- Specified by:
onRoomLeft
in interfaceClientEventListener
- Parameters:
client
- - the Client which triggered this event
-
onMessageReceivedJson
Description copied from interface:ClientEventListener
Event-Handler/Callback called when the Client receives a custom Json message from the server- Specified by:
onMessageReceivedJson
in interfaceClientEventListener
- Parameters:
client
- - the Client which receives the messagecommand
- - the message commanddata
- - the message data as json
-
onMessageReceivedString
Description copied from interface:ClientEventListener
Event-Handler/Callback called when the Client receives a custom text message from the server- Specified by:
onMessageReceivedString
in interfaceClientEventListener
- Parameters:
client
- - the Client which receives the messagecommand
- - the message commanddata
- - the message data as String
-
onMessageReceivedBytes
Description copied from interface:ClientEventListener
Event-Handler/Callback called when the Client receives a custom binary message from the server- Specified by:
onMessageReceivedBytes
in interfaceClientEventListener
- Parameters:
client
- - the Client which receives the messagecommand
- - the message commanddata
- - the message data as a byte array
-
onGamePlayStarted
Description copied from interface:ClientEventListener
Event-Handler/Callback called when game play starts in the room- Specified by:
onGamePlayStarted
in interfaceClientEventListener
- Parameters:
client
- - the Client which receives this eventroom
- - 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 interfaceClientEventListener
- Parameters:
client
- - the Client which receives this eventturnPlayer
- - the player whose turn it isturnData
- - 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 clientisSelfTurn
- - 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 interfaceClientEventListener
- Parameters:
client
- - the Client which receives this eventturnPlayer
- - the player who played the actionplayerAction
- - the action played by the playeractionData
- - the action data if any. For e.g. in a game like Poker it could be {"amtBet":20}room
- - the room joined by this clientisSelf
- - 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 interfaceClientEventListener
- Parameters:
client
- - the Client which receives this eventoutOfTurnPlayer
- - the player who played the actionplayerAction
- - the action played by the playeractionData
- - the action data if any.room
- - the room joined by this clientisSelf
- - whether the action was played by the client which received this event
-
onGameAction
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 interfaceClientEventListener
- Parameters:
client
- - the Client which receives this eventgameAction
- - the game actionactionData
- - the action data. For e.g. in a game like poker this could be the value of the flop cardsroom
- - the room joined by this client
-
onGamePlayEnded
Description copied from interface:ClientEventListener
Event-Handler/Callback called when game play ends in the room- Specified by:
onGamePlayEnded
in interfaceClientEventListener
- Parameters:
client
- - the Client which receives this eventroom
- - the room joined by this clientendGameData
- - the data received with the endGame event. For e.g this could be the winning seat no and the amount won
-
onRoomDestroyed
Description copied from interface:ClientEventListener
Event-Handler/Callback called when the room joined by this client is destroyed- Specified by:
onRoomDestroyed
in interfaceClientEventListener
- Parameters:
client
- - the Client which receives this eventroom
- - the room which was destroyed
-
onAvtarChangedOfSelf
Description copied from interface:ClientEventListener
Event-Handler/Callback called when the avtar of the user loggedIn via this client changes- Specified by:
onAvtarChangedOfSelf
in interfaceClientEventListener
- Parameters:
client
- - the Client which receives this eventnewAvtarId
- - the new avtarId of the user
-
onAvtarChangedOfOtherPlayer
Description copied from interface:ClientEventListener
Event-Handler/Callback called when the avtar of another player is changed- Specified by:
onAvtarChangedOfOtherPlayer
in interfaceClientEventListener
- Parameters:
client
- - the Client which receives this eventplayer
- - the player whose avtar is changednewAvtarId
- - the new avtarIDroom
- - the room joined by this client
-
onNotEligibleToPlay
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 interfaceClientEventListener
- Parameters:
client
- - the Client which receives this eventplayer
- - the player linked to this clientroom
- - the room joined by this clientreason
- - the reason why player is not eligible
-
onSessionRejoined
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 interfaceClientEventListener
- Parameters:
client
- - the Client which receives this event
-
onConnecting
Description copied from interface:ClientEventListener
Event-Handler/Callback called when Client is attempting to connect to the server- Specified by:
onConnecting
in interfaceClientEventListener
- Parameters:
client
- - the Client which triggers this event
-
onConnectionSuccess
Description copied from interface:ClientEventListener
Event-Handler/Callback called when Client is successfully connected to the server- Specified by:
onConnectionSuccess
in interfaceClientEventListener
- Parameters:
client
- - the Client which triggers this event
-
onConnectionFailure
Description copied from interface:ClientEventListener
Event-Handler/Callback called when Client is fails to connect to the server- Specified by:
onConnectionFailure
in interfaceClientEventListener
- Parameters:
client
- - the Client which triggers this event
-
onConnectionDisconnected
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 interfaceClientEventListener
- Parameters:
client
- - the Client which triggers this event
-
onConnectionClosed
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 interfaceClientEventListener
- 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 interfaceClientEventListener
- Parameters:
client
- - the Client which triggers this eventaction
- - the action playeddescription
- - the error descriptionerrorData
- - the error data containing more info about the errorroom
- - the room joined by the clientisOutOfTurn
- - true if the action was played out of turn
-
onEnterGame
Description copied from interface:ClientEventListener
Event-Handler/Callback called when Client enters/selects a game.- Specified by:
onEnterGame
in interfaceClientEventListener
- Parameters:
client
- - the Client which triggers this eventgameName
- - the name of the game entered/selected
-
onExitGame
Description copied from interface:ClientEventListener
Event-Handler/Callback called when Client exits/deselects a game.- Specified by:
onExitGame
in interfaceClientEventListener
- Parameters:
client
- - the Client which triggers this eventgameName
- - the name of the game exited/deselected
-