Package io.sockit.gameserver.bot
Class Room
java.lang.Object
io.sockit.gameserver.bot.Room
public class Room extends Object implements Iterable<Player>
This class represents a game room for a Bot. An instance of this class is passed to many of the event/callback methods in the BotListener interface
-
Field Summary
Fields Modifier and Type Field Description String
gameName
The name of the game that this room belongs toString
location
The location of this roomlong
roomId
The roomID of this roomString
roomName
The name of this roomRoomType
roomType
The type of this room (normal or fast)int
totalNoOfSeats
The total number of seats in this roomint
turnDurationMillis
The duration of a turn in this room in milliseconds -
Method Summary
Modifier and Type Method Description Player
getCurTurnPlayer()
Returns the player whose turn is the current turnint
getCurTurnSeatNo()
Returns the seat number of the player whose turn is the current turnJsonObject
getData()
Returns the room data as jsonint
getFreeSeatNo()
Returns the first free seat numberint
getGameNo()
Returns the number of the currently active game play in this room.Player
getNextPlayer(int prevSeatNo)
Returns the next player seated after the specified seat numberPlayer
getNextPlayer(Player prevPlayer)
Returns the next player seated after the specified playerPlayer
getPlayerBySeatNo(int seatNo)
Returns the player seated at the specified seat numberPlayer
getPlayerByUserId(String userId)
Returns the player whose userId matches the specified userIdint
getPlayerCount()
Returns the number of players seated in the roomboolean
isGamePlayEnding()
Returns true if gamePlay is ending in this roomboolean
isGamePlayInProgress()
Returns true if gamePlay is in progress in this roomboolean
isSeatFree(int seatNo)
Returns true if the seat number is freeIterator<Player>
iterator()
Returns an iterator which iterates through all the players in the room
-
Field Details
-
gameName
The name of the game that this room belongs to -
location
The location of this room -
roomId
public final long roomIdThe roomID of this room -
roomName
The name of this room -
totalNoOfSeats
public final int totalNoOfSeatsThe total number of seats in this room -
turnDurationMillis
public final int turnDurationMillisThe duration of a turn in this room in milliseconds -
roomType
The type of this room (normal or fast)
-
-
Method Details
-
isGamePlayInProgress
public boolean isGamePlayInProgress()Returns true if gamePlay is in progress in this room- Returns:
- boolean - true if gamePlay is in progress in this room
-
isGamePlayEnding
public boolean isGamePlayEnding()Returns true if gamePlay is ending in this room- Returns:
- - true if gamePlay is ending in this room
-
getData
Returns the room data as json- Returns:
- JsonObject - the room data as json
-
getGameNo
public final int getGameNo()Returns the number of the currently active game play in this room. When a new game play starts, the gamePlay number is incremented by 1. The number of the first game play is 1. This value is mainly for debugging purposes to identify which game play number the debug message belongs to- Returns:
- int - the number of the currently active game play in this room
-
getCurTurnSeatNo
public int getCurTurnSeatNo()Returns the seat number of the player whose turn is the current turn- Returns:
- int - the seat number of the player whose turn is the current turn
-
getCurTurnPlayer
Returns the player whose turn is the current turn- Returns:
- Player - the player whose turn is the current turn
-
getPlayerByUserId
Returns the player whose userId matches the specified userId- Parameters:
userId
- - the userId to match- Returns:
- Player - the player whose userId matches the specified userId
-
getPlayerCount
public int getPlayerCount()Returns the number of players seated in the room- Returns:
- - the number of players seated in the room
-
getPlayerBySeatNo
Returns the player seated at the specified seat number- Parameters:
seatNo
- - the specified seat number- Returns:
- Player - the player seated at the specified seat number
-
getFreeSeatNo
public int getFreeSeatNo()Returns the first free seat number- Returns:
- int - the first free seat number
-
isSeatFree
public boolean isSeatFree(int seatNo)Returns true if the seat number is free- Parameters:
seatNo
- - the seat number to check- Returns:
- boolean - true if the seat number is free
-
getNextPlayer
Returns the next player seated after the specified seat number- Parameters:
prevSeatNo
- - the previous seat number- Returns:
- Player - the next player seated after the specified seat number
-
getNextPlayer
Returns the next player seated after the specified player- Parameters:
prevPlayer
- - the previous player- Returns:
- player - the next player seated after the specified player
-
iterator
Returns an iterator which iterates through all the players in the room
-