Class Room

java.lang.Object
io.sockit.gameserver.bot.Room
All Implemented Interfaces:
Iterable<Player>

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 Details

    • gameName

      public final String gameName
      The name of the game that this room belongs to
    • location

      public final String location
      The location of this room
    • roomId

      public final long roomId
      The roomID of this room
    • roomName

      public final String roomName
      The name of this room
    • totalNoOfSeats

      public final int totalNoOfSeats
      The total number of seats in this room
    • turnDurationMillis

      public final int turnDurationMillis
      The duration of a turn in this room in milliseconds
    • roomType

      public final RoomType 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

      public JsonObject 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

      public Player getCurTurnPlayer()
      Returns the player whose turn is the current turn
      Returns:
      Player - the player whose turn is the current turn
    • getPlayerByUserId

      public Player getPlayerByUserId​(String userId)
      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

      public Player getPlayerBySeatNo​(int seatNo)
      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

      public Player getNextPlayer​(int prevSeatNo)
      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

      public Player getNextPlayer​(Player prevPlayer)
      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

      public Iterator<Player> iterator()
      Returns an iterator which iterates through all the players in the room
      Specified by:
      iterator in interface Iterable<Player>
      Returns:
      Iterator - an iterator which iterates through all the players in the room