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 void
onAvtarChangedOfOtherPlayer(Bot bot, Player player, int newAvtarId, Room room)
Event-Handler/Callback called when the avtar of another player is changedvoid
onAvtarChangedOfSelf(Bot bot, int newAvtarId)
Event-Handler/Callback called when the avtar of the user loggedIn via this bot changesvoid
onError(Bot bot, int errorCode, String errorDesc)
Event-Handler/Callback called when an error is triggered on the server.void
onGameAction(Bot bot, String gameAction, JsonObject actionData, Room room)
Event-Handler/Callback called when a game action occurs in the game.void
onGamePlayEnded(Bot bot, Room room, JsonObject endGameData)
Event-Handler/Callback called when game play ends in the roomvoid
onGamePlayStarted(Bot bot, Room room)
Event-Handler/Callback called when game play starts in the roomvoid
onGetLocations(Bot bot, String gameName, List<String> locations)
Event-Handler/Callback called when the Bot receives the location list from the Servervoid
onGetRooms(Bot bot, String gameName, String location, RoomType roomtype, List<RoomInfo> rooms)
Event-Handler/Callback called when the Bot receives the room list from the Servervoid
onInvalidAction(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 validvoid
onLoggedIn(Bot bot)
Event-Handler/Callback called when the Bot successfully logins into the servervoid
onLoggedOut(Bot bot)
Event-Handler/Callback called when the Bot successfully logouts from the servervoid
onMessageReceivedBytes(Bot bot, String command, byte[] data)
Event-Handler/Callback called when the Bot receives a custom binary message from the servervoid
onMessageReceivedJson(Bot bot, String command, JsonObject data)
Event-Handler/Callback called when the Bot receives a custom Json message from the servervoid
onMessageReceivedString(Bot bot, String command, String data)
Event-Handler/Callback called when the Bot receives a custom text message from the servervoid
onNextTurn(Bot bot, Player turnPlayer, JsonObject turnData, Room room, boolean isSelfTurn)
Event-Handler/Callback called when a new turn beginsvoid
onNotEligibleToPlay(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 startingvoid
onOutOfTurnPlayed(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 playervoid
onRoomDestroyed(Bot bot, Room room)
Event-Handler/Callback called when the room joined by this bot is destroyedvoid
onRoomJoined(Bot bot, Room room)
Event-Handler/Callback called when the Bot joins a roomvoid
onRoomLeft(Bot bot)
Event-Handler/Callback called when the Bot leaves the roomvoid
onRoomRefreshedFromServer(Bot bot, Room room)
Event-Handler/Callback called when the room state is refreshed from the server.void
onSeatLeft(Bot bot, Player playerLeft, Room room, boolean isSelf)
Event-Handler/Callback called when any user leaves a seat in the room.void
onSeatTaken(Bot bot, Player playerSeated, Room room, boolean isSelf)
Event-Handler/Callback called when any user takes a seat in the room.void
onServerShutdown(Bot bot)
Event-Handler/Callback called when the server shutsdownvoid
onSessionTimedOut(Bot bot)
Event-Handler/Callback called when the Bot's session times out on the servervoid
onTurnPlayed(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:BotEventListener
Event-Handler/Callback called when an error is triggered on the server.- Specified by:
onError
in 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:BotEventListener
Event-Handler/Callback called when the Bot successfully logins into the server- Specified by:
onLoggedIn
in interfaceBotEventListener
- Parameters:
bot
- - the Bot which loggedIn
-
onLoggedOut
Description copied from interface:BotEventListener
Event-Handler/Callback called when the Bot successfully logouts from the server- Specified by:
onLoggedOut
in interfaceBotEventListener
- Parameters:
bot
- - the bot which loggedOut
-
onSessionTimedOut
Description copied from interface:BotEventListener
Event-Handler/Callback called when the Bot's session times out on the server- Specified by:
onSessionTimedOut
in interfaceBotEventListener
- Parameters:
bot
- - the bot whose session timed out
-
onServerShutdown
Description copied from interface:BotEventListener
Event-Handler/Callback called when the server shutsdown- Specified by:
onServerShutdown
in interfaceBotEventListener
- Parameters:
bot
- - the Bot which triggered this event
-
onGetLocations
Description copied from interface:BotEventListener
Event-Handler/Callback called when the Bot receives the location list from the Server- Specified by:
onGetLocations
in 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:BotEventListener
Event-Handler/Callback called when the Bot receives the room list from the Server- Specified by:
onGetRooms
in 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:BotEventListener
Event-Handler/Callback called when the Bot joins a room- Specified by:
onRoomJoined
in interfaceBotEventListener
- Parameters:
bot
- - the Bot which triggered this eventroom
- - the room joined by this Bot
-
onRoomRefreshedFromServer
Description copied from interface:BotEventListener
Event-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:
onRoomRefreshedFromServer
in interfaceBotEventListener
- Parameters:
bot
- - the Bot which triggered this eventroom
- - the room joined by the bot
-
onSeatTaken
Description copied from interface:BotEventListener
Event-Handler/Callback called when any user takes a seat in the room.- Specified by:
onSeatTaken
in 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:BotEventListener
Event-Handler/Callback called when any user leaves a seat in the room.- Specified by:
onSeatLeft
in 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:BotEventListener
Event-Handler/Callback called when the Bot leaves the room- Specified by:
onRoomLeft
in interfaceBotEventListener
- Parameters:
bot
- - the Bot which triggered this event
-
onMessageReceivedJson
Description copied from interface:BotEventListener
Event-Handler/Callback called when the Bot receives a custom Json message from the server- Specified by:
onMessageReceivedJson
in interfaceBotEventListener
- Parameters:
bot
- - the Bot which receives the messagecommand
- - the message commanddata
- - the message data as json
-
onMessageReceivedString
Description copied from interface:BotEventListener
Event-Handler/Callback called when the Bot receives a custom text message from the server- Specified by:
onMessageReceivedString
in interfaceBotEventListener
- Parameters:
bot
- - the Bot which receives the messagecommand
- - the message commanddata
- - the message data as String
-
onMessageReceivedBytes
Description copied from interface:BotEventListener
Event-Handler/Callback called when the Bot receives a custom binary message from the server- Specified by:
onMessageReceivedBytes
in interfaceBotEventListener
- Parameters:
bot
- - the Bot which receives the messagecommand
- - the message commanddata
- - the message data as a byte array
-
onGamePlayStarted
Description copied from interface:BotEventListener
Event-Handler/Callback called when game play starts in the room- Specified by:
onGamePlayStarted
in 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:BotEventListener
Event-Handler/Callback called when a new turn begins- Specified by:
onNextTurn
in 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:BotEventListener
Event-Handler/Callback called when a player plays his/her turn- Specified by:
onTurnPlayed
in 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:BotEventListener
Event-Handler/Callback called when an action is played out of turn by a player- Specified by:
onOutOfTurnPlayed
in 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:BotEventListener
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 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:BotEventListener
Event-Handler/Callback called when game play ends in the room- Specified by:
onGamePlayEnded
in 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:BotEventListener
Event-Handler/Callback called when the room joined by this bot is destroyed- Specified by:
onRoomDestroyed
in interfaceBotEventListener
- Parameters:
bot
- - the Bot which receives this eventroom
- - the room which was destroyed
-
onAvtarChangedOfSelf
Description copied from interface:BotEventListener
Event-Handler/Callback called when the avtar of the user loggedIn via this bot changes- Specified by:
onAvtarChangedOfSelf
in interfaceBotEventListener
- Parameters:
bot
- - the Bot which receives this eventnewAvtarId
- - the new avtarId of the user
-
onAvtarChangedOfOtherPlayer
Description copied from interface:BotEventListener
Event-Handler/Callback called when the avtar of another player is changed- Specified by:
onAvtarChangedOfOtherPlayer
in 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:BotEventListener
Event-Handler/Callback called when the Bot is not eligible to play the new game play that is starting- Specified by:
onNotEligibleToPlay
in 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:BotEventListener
Event-Handler/Callback called when an action played by the Bot is not valid- Specified by:
onInvalidAction
in 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
-