Interface Client


public interface Client
Represents a single connected game client with its associated API and event bus.
  • Method Summary

    Modifier and Type
    Method
    Description
    default Optional<String>
    The display name of the character on this client, once the host knows it.
    Returns the event bus for this client.
    Returns the game API for this client.
    Returns the unique name identifying this client connection.
    boolean
    Checks whether this client is still connected to the game server.
    Returns a tick-scoped read view of the producer's current game state.
  • Method Details

    • getName

      String getName()
      Returns the unique name identifying this client connection.
      Returns:
      the client name
    • getGameAPI

      GameAPI getGameAPI()
      Returns the game API for this client.
      Returns:
      the GameAPI instance bound to this client
    • getEventBus

      EventBus getEventBus()
      Returns the event bus for this client.
      Returns:
      the EventBus instance bound to this client
    • isConnected

      boolean isConnected()
      Checks whether this client is still connected to the game server.
      Returns:
      true if the connection is active
    • snapshot

      GameSnapshot snapshot()
      Returns a tick-scoped read view of the producer's current game state. Each call returns a fresh snapshot bound to the producer's currently published buffer; do not cache the result across ticks. Returns null when this client was constructed without a shared-memory binding (e.g. headless/test contexts).
      Returns:
      a GameSnapshot, or null when unbound
    • getDisplayName

      default Optional<String> getDisplayName()
      The display name of the character on this client, once the host knows it.

      When the client was launched for a known Jagex character, this is that character's name from the login screen on, and through the lobby. Once in a world it is the name the client reports for the logged-in player; if that differs from the launched character (the client was relogged as someone else), the logged-in name wins. Otherwise, for a client not launched for a known Jagex character, it is empty until the client is in a world and the host has read the name, and empty again after a logout. Either way it can be briefly empty right after a login state change while the host re-reads it. A later login, including as a different character, is picked up without reconnecting. Cheap to call: it never blocks on the client.

      The default returns empty, for clients that are not bound to a live game client (test and headless contexts).

      Returns:
      the character's display name, or empty while it is not known