Interface IClient

All Known Implementing Classes:
AbstractClient, BotClient, Client, HeadlessClient, Princess, SBFClient, SimulatedClient

public interface IClient
  • Method Details

    • connect

      boolean connect()
      Attempt to connect to the specified host
      Returns:
      true if successful.
    • getName

      String getName()
      Returns:
      The name of Client, typically the same as the local player's name.
    • getPort

      int getPort()
      Returns:
      The port that this Client uses to connect to the server.
    • getHost

      String getHost()
      Returns:
      The server host address.
    • die

      void die()
      Cleans up and closes resources of this Client.
    • getGame

      IGame getGame()
      Returns the game of this client as a game-type independent IGame. Note that the game object is only updated, not replaced and a reference to it can therefore be kept.
      Returns:
      The game of this client
    • getInGameObject

      default Optional<InGameObject> getInGameObject(int id)
      Parameters:
      id - The in-game object associated with the given ID.
      Returns:
      An Optional of InGameObject if it exists.
    • getInGameObjects

      default List<InGameObject> getInGameObjects()
      Returns:
      A list of all in-game objects of the game. This list is copied and may be safely modified.
    • getPlayer

      default Player getPlayer(int id)
      Parameters:
      id - The player with the given ID, or null if there is no such player.
      Returns:
      The player object.
    • getLocalPlayerNumber

      int getLocalPlayerNumber()
      Returns:
      The ID of the player playing at this Client.
    • isMyTurn

      boolean isMyTurn()
      Returns:
      True when the currently active turn is a turn for the local player
    • setLocalPlayerNumber

      void setLocalPlayerNumber(int localPlayerNumber)
      Sets the ID of the player playing at this Client.
      Parameters:
      localPlayerNumber - The new local player's ID
    • getLocalPlayer

      default Player getLocalPlayer()
      Returns:
      The local player (playing at this Client).
    • playerExists

      default boolean playerExists(int id)
      Parameters:
      id - ID of player
      Returns:
      True when there is a player (incl. bot) with the given ID in the game.
    • getBots

      Returns the map containing this Client's local bots, wherein the key is the bot's player name and the value the Client.
      Returns:
      This Client's local bots mapped to their player name
    • isLocalBot

      default boolean isLocalBot(Player player)
      Parameters:
      player - the Player that we need to know is a bot or not.
      Returns:
      True when the given player is a bot added/controlled by this Client.
    • getBotClient

      default AbstractClient getBotClient(Player player)
      Returns the Client associated with the given local bot player. If the player is not a local bot, returns null.
      Parameters:
      player - The player whose client we're looking for.
      Returns:
      The Client for the given player if it's a bot, null otherwise
    • sendDone

      void sendDone(boolean done)
      Sends a "this player is done/not done" message to the server.
      Parameters:
      done - Is the player done or not.
    • sendChat

      void sendChat(String message)
    • sendPause

      void sendPause()