Class Player

java.lang.Object
io.sockit.gameclient.Player

public class Player
extends Object
This class represents a Player seated in the room and can be used to render a player onto the UI
  • Field Details

    • userId

      public final String userId
      The userId of this player. The userId uniquely identifies a user registered on the GameServer
    • seatNo

      public final int seatNo
      The seat number of the player. The first seat number is 1
    • room

      public volatile Room room
      The room in which the player is seated
  • Method Details

    • getName

      public String getName()
      The name of the player
      Returns:
      String - the name of the player
    • getAvtarId

      public int getAvtarId()
      The avatar Id of the player
      Returns:
      int - the avatar Id of the player
    • shouldUseProfilePicture

      public boolean shouldUseProfilePicture()
      Indicates whether to display the player's profile picture or the player's avatar
      Returns:
      boolean - true if the player's profile picture should be displayed instead of the player's avatar
    • getProfilePic

      public String getProfilePic()
      Returns the url of player's profile picture
      Returns:
      String - the url of player's profile picture
    • isActive

      public boolean isActive()
      Returns true if the player is an active player (taking part in the current game play)
      Returns:
      boolean - true if the player is an active player
    • getTurnTimeLeftMillis

      public int getTurnTimeLeftMillis()
      Returns the turn time left in milliseconds
      Returns:
      int - the turn time left in milliseconds
    • getData

      public JsonObject getData()
      Returns the player's data as json
      Returns:
      JsonObject - the player's data as json
    • isCurTurn

      public boolean isCurTurn()
      Returns true if the current turn is the players turn
      Returns:
      boolean - true if the current turn is the players turn
    • isSameAsClient

      public boolean isSameAsClient​(Client client)
      Returns true if the player belongs to the specified client
      Parameters:
      client - - the client to check
      Returns:
      boolean - true if the player belongs to the specified client