Package io.sockit.gameserver.bot
Class BotEventAdapter
java.lang.Object
io.sockit.gameserver.bot.BotEventAdapter
- All Implemented Interfaces:
BotEventListener
public abstract class BotEventAdapter extends Object implements BotEventListener
An abstract adapter class for receiving bot events. The methods in this class are empty.
This class exists as convenience for creating BotEventListener objects.
-
Constructor Summary
Constructors Constructor Description BotEventAdapter() -
Method Summary
Modifier and Type Method Description voidonAvtarChangedOfOtherPlayer(Bot bot, Player player, int newAvtarId, Room room)Event-Handler/Callback called when the avtar of another player is changedvoidonAvtarChangedOfSelf(Bot bot, int newAvtarId)Event-Handler/Callback called when the avtar of the user loggedIn via this bot changesvoidonError(Bot bot, int errorCode, String errorDesc)Event-Handler/Callback called when an error is triggered on the server.voidonGameAction(Bot bot, String gameAction, JsonObject actionData, Room room)Event-Handler/Callback called when a game action occurs in the game.voidonGamePlayEnded(Bot bot, Room room, JsonObject endGameData)Event-Handler/Callback called when game play ends in the roomvoidonGamePlayStarted(Bot bot, Room room)Event-Handler/Callback called when game play starts in the roomvoidonGetLocations(Bot bot, String gameName, List<String> locations)Event-Handler/Callback called when the Bot receives the location list from the ServervoidonGetRooms(Bot bot, String gameName, String location, RoomType roomtype, List<RoomInfo> rooms)Event-Handler/Callback called when the Bot receives the room list from the ServervoidonInvalidAction(Bot bot, String action, String description, JsonObject errorData, Room room, boolean isOutOfTurn)Event-Handler/Callback called when an action played by the Bot is not validvoidonLoggedIn(Bot bot)Event-Handler/Callback called when the Bot successfully logins into the servervoidonLoggedOut(Bot bot)Event-Handler/Callback called when the Bot successfully logouts from the servervoidonMessageReceivedBytes(Bot bot, String command, byte[] data)Event-Handler/Callback called when the Bot receives a custom binary message from the servervoidonMessageReceivedJson(Bot bot, String command, JsonObject data)Event-Handler/Callback called when the Bot receives a custom Json message from the servervoidonMessageReceivedString(Bot bot, String command, String data)Event-Handler/Callback called when the Bot receives a custom text message from the servervoidonNextTurn(Bot bot, Player turnPlayer, JsonObject turnData, Room room, boolean isSelfTurn)Event-Handler/Callback called when a new turn beginsvoidonNotEligibleToPlay(Bot bot, Player player, Room room, String reason)Event-Handler/Callback called when the Bot is not eligible to play the new game play that is startingvoidonOutOfTurnPlayed(Bot bot, Player outOfTurnPlayer, String playerAction, JsonObject actionData, Room room, boolean isSelf)Event-Handler/Callback called when an action is played out of turn by a playervoidonRoomDestroyed(Bot bot, Room room)Event-Handler/Callback called when the room joined by this bot is destroyedvoidonRoomJoined(Bot bot, Room room)Event-Handler/Callback called when the Bot joins a roomvoidonRoomLeft(Bot bot)Event-Handler/Callback called when the Bot leaves the roomvoidonRoomRefreshedFromServer(Bot bot, Room room)Event-Handler/Callback called when the room state is refreshed from the server.voidonSeatLeft(Bot bot, Player playerLeft, Room room, boolean isSelf)Event-Handler/Callback called when any user leaves a seat in the room.voidonSeatTaken(Bot bot, Player playerSeated, Room room, boolean isSelf)Event-Handler/Callback called when any user takes a seat in the room.voidonServerShutdown(Bot bot)Event-Handler/Callback called when the server shutsdownvoidonSessionTimedOut(Bot bot)Event-Handler/Callback called when the Bot's session times out on the servervoidonTurnPlayed(Bot bot, Player turnPlayer, String playerAction, JsonObject actionData, Room room, boolean isSelf)Event-Handler/Callback called when a player plays his/her turn
-
Constructor Details
-
BotEventAdapter
public BotEventAdapter()
-
-
Method Details
-
onError
Description copied from interface:BotEventListenerEvent-Handler/Callback called when an error is triggered on the server.- Specified by:
onErrorin interfaceBotEventListener- Parameters:
bot- - the Bot which triggered the errorerrorCode- - the errorCode e.g. ErrorCodes.emailIdAndPasswordDoesNotMatch or ErrorCodes.seatNotFree or ...errorDesc- - the error description
-
onLoggedIn
Description copied from interface:BotEventListenerEvent-Handler/Callback called when the Bot successfully logins into the server- Specified by:
onLoggedInin interfaceBotEventListener- Parameters:
bot- - the Bot which loggedIn
-
onLoggedOut
Description copied from interface:BotEventListenerEvent-Handler/Callback called when the Bot successfully logouts from the server- Specified by:
onLoggedOutin interfaceBotEventListener- Parameters:
bot- - the bot which loggedOut
-
onSessionTimedOut
Description copied from interface:BotEventListenerEvent-Handler/Callback called when the Bot's session times out on the server- Specified by:
onSessionTimedOutin interfaceBotEventListener- Parameters:
bot- - the bot whose session timed out
-
onServerShutdown
Description copied from interface:BotEventListenerEvent-Handler/Callback called when the server shutsdown- Specified by:
onServerShutdownin interfaceBotEventListener- Parameters:
bot- - the Bot which triggered this event
-
onGetLocations
Description copied from interface:BotEventListenerEvent-Handler/Callback called when the Bot receives the location list from the Server- Specified by:
onGetLocationsin interfaceBotEventListener- Parameters:
bot- - the Bot which triggered this eventgameName- - the name of the game whose locations were requested by the Botlocations- - the list of locations
-
onGetRooms
public void onGetRooms(Bot bot, String gameName, String location, RoomType roomtype, List<RoomInfo> rooms)Description copied from interface:BotEventListenerEvent-Handler/Callback called when the Bot receives the room list from the Server- Specified by:
onGetRoomsin interfaceBotEventListener- Parameters:
bot- - the Bot which triggered this eventgameName- - the name of the game whose room list was requested by the Botlocation- - 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:BotEventListenerEvent-Handler/Callback called when the Bot joins a room- Specified by:
onRoomJoinedin interfaceBotEventListener- Parameters:
bot- - the Bot which triggered this eventroom- - the room joined by this Bot
-
onRoomRefreshedFromServer
Description copied from interface:BotEventListenerEvent-Handler/Callback called when the room state is refreshed from the server. Gets triggered when Bot receives a ServerMessageType.roomData message from the Server- Specified by:
onRoomRefreshedFromServerin interfaceBotEventListener- Parameters:
bot- - the Bot which triggered this eventroom- - the room joined by the bot
-
onSeatTaken
Description copied from interface:BotEventListenerEvent-Handler/Callback called when any user takes a seat in the room.- Specified by:
onSeatTakenin interfaceBotEventListener- Parameters:
bot- - the Bot which receives this eventplayerSeated- - the player which took seatroom- - the room joined by this botisSelf- - if the user seated is the same as this Bot
-
onSeatLeft
Description copied from interface:BotEventListenerEvent-Handler/Callback called when any user leaves a seat in the room.- Specified by:
onSeatLeftin interfaceBotEventListener- Parameters:
bot- - the Bot which receives this eventplayerLeft- - the player which left the seatroom- - the room joined by this botisSelf- - if the user which left is the same as this Bot
-
onRoomLeft
Description copied from interface:BotEventListenerEvent-Handler/Callback called when the Bot leaves the room- Specified by:
onRoomLeftin interfaceBotEventListener- Parameters:
bot- - the Bot which triggered this event
-
onMessageReceivedJson
Description copied from interface:BotEventListenerEvent-Handler/Callback called when the Bot receives a custom Json message from the server- Specified by:
onMessageReceivedJsonin interfaceBotEventListener- Parameters:
bot- - the Bot which receives the messagecommand- - the message commanddata- - the message data as json
-
onMessageReceivedString
Description copied from interface:BotEventListenerEvent-Handler/Callback called when the Bot receives a custom text message from the server- Specified by:
onMessageReceivedStringin interfaceBotEventListener- Parameters:
bot- - the Bot which receives the messagecommand- - the message commanddata- - the message data as String
-
onMessageReceivedBytes
Description copied from interface:BotEventListenerEvent-Handler/Callback called when the Bot receives a custom binary message from the server- Specified by:
onMessageReceivedBytesin interfaceBotEventListener- Parameters:
bot- - the Bot which receives the messagecommand- - the message commanddata- - the message data as a byte array
-
onGamePlayStarted
Description copied from interface:BotEventListenerEvent-Handler/Callback called when game play starts in the room- Specified by:
onGamePlayStartedin interfaceBotEventListener- Parameters:
bot- - the Bot which receives this eventroom- - the room joined by this bot
-
onNextTurn
public void onNextTurn(Bot bot, Player turnPlayer, JsonObject turnData, Room room, boolean isSelfTurn)Description copied from interface:BotEventListenerEvent-Handler/Callback called when a new turn begins- Specified by:
onNextTurnin interfaceBotEventListener- Parameters:
bot- - the Bot 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 botisSelfTurn- - whether its the turn of the bot which received this event
-
onTurnPlayed
public void onTurnPlayed(Bot bot, Player turnPlayer, String playerAction, JsonObject actionData, Room room, boolean isSelf)Description copied from interface:BotEventListenerEvent-Handler/Callback called when a player plays his/her turn- Specified by:
onTurnPlayedin interfaceBotEventListener- Parameters:
bot- - the Bot 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 botisSelf- - whether the action was played by the bot which received this event
-
onOutOfTurnPlayed
public void onOutOfTurnPlayed(Bot bot, Player outOfTurnPlayer, String playerAction, JsonObject actionData, Room room, boolean isSelf)Description copied from interface:BotEventListenerEvent-Handler/Callback called when an action is played out of turn by a player- Specified by:
onOutOfTurnPlayedin interfaceBotEventListener- Parameters:
bot- - the Bot 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 botisSelf- - whether the action was played by the bot which received this event
-
onGameAction
Description copied from interface:BotEventListenerEvent-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:
onGameActionin interfaceBotEventListener- Parameters:
bot- - the Bot 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 bot
-
onGamePlayEnded
Description copied from interface:BotEventListenerEvent-Handler/Callback called when game play ends in the room- Specified by:
onGamePlayEndedin interfaceBotEventListener- Parameters:
bot- - the Bot which receives this eventroom- - the room joined by this botendGameData- - 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:BotEventListenerEvent-Handler/Callback called when the room joined by this bot is destroyed- Specified by:
onRoomDestroyedin interfaceBotEventListener- Parameters:
bot- - the Bot which receives this eventroom- - the room which was destroyed
-
onAvtarChangedOfSelf
Description copied from interface:BotEventListenerEvent-Handler/Callback called when the avtar of the user loggedIn via this bot changes- Specified by:
onAvtarChangedOfSelfin interfaceBotEventListener- Parameters:
bot- - the Bot which receives this eventnewAvtarId- - the new avtarId of the user
-
onAvtarChangedOfOtherPlayer
Description copied from interface:BotEventListenerEvent-Handler/Callback called when the avtar of another player is changed- Specified by:
onAvtarChangedOfOtherPlayerin interfaceBotEventListener- Parameters:
bot- - the Bot which receives this eventplayer- - the player whose avtar is changednewAvtarId- - the new avtarIDroom- - the room joined by this bot
-
onNotEligibleToPlay
Description copied from interface:BotEventListenerEvent-Handler/Callback called when the Bot is not eligible to play the new game play that is starting- Specified by:
onNotEligibleToPlayin interfaceBotEventListener- Parameters:
bot- - the Bot which receives this eventplayer- - the player linked to this botroom- - the room joined by this botreason- - the reason why player is not eligible
-
onInvalidAction
public void onInvalidAction(Bot bot, String action, String description, JsonObject errorData, Room room, boolean isOutOfTurn)Description copied from interface:BotEventListenerEvent-Handler/Callback called when an action played by the Bot is not valid- Specified by:
onInvalidActionin interfaceBotEventListener- Parameters:
bot- - the Bot which triggers this eventaction- - the action playeddescription- - the error descriptionerrorData- - the error data containing more info about the errorroom- - the room joined by the botisOutOfTurn- - true if the action was played out of turn
-