Interface ClusterPlayerService


public interface ClusterPlayerService
Service for tracking and querying players across all proxies in the cluster.

Provides aggregate counts, lookups by name or UUID, per-server and per-proxy player listings, and cluster-wide broadcast capabilities.

  • Method Details

    • getTotalPlayerCount

      int getTotalPlayerCount()
      Gets the total number of players connected across all proxies.
      Returns:
      the cluster-wide player count
    • getPlayersOnServerCount

      int getPlayersOnServerCount(String serverName)
      Gets the number of players currently on the specified backend server.
      Parameters:
      serverName - the name of the backend server
      Returns:
      the player count for that server
    • getPlayersOnServerCount

      default int getPlayersOnServerCount(RegisteredServer server)
      Gets the number of players currently on the specified backend server.
      Parameters:
      server - the backend server
      Returns:
      the player count for that server
    • getAllPlayers

      Collection<? extends ClusterPlayer> getAllPlayers()
      Gets all players connected anywhere in the cluster.
      Returns:
      an unmodifiable collection of all cluster players
    • getPlayersOnServer

      Collection<? extends ClusterPlayer> getPlayersOnServer(String serverName)
      Gets all players currently on the specified backend server.
      Parameters:
      serverName - the name of the backend server
      Returns:
      an unmodifiable collection of players on that server
    • getPlayersOnServer

      default Collection<? extends ClusterPlayer> getPlayersOnServer(RegisteredServer server)
      Gets all players currently on the specified backend server.
      Parameters:
      server - the backend server
      Returns:
      an unmodifiable collection of players on that server
    • getPlayersOnProxy

      Collection<? extends ClusterPlayer> getPlayersOnProxy(String proxyId)
      Gets all players connected to the specified proxy.
      Parameters:
      proxyId - the proxy identifier
      Returns:
      an unmodifiable collection of players on that proxy
    • getPlayer

      Optional<? extends ClusterPlayer> getPlayer(String username)
      Looks up a player by username across the cluster.
      Parameters:
      username - the player's username (case-insensitive)
      Returns:
      an optional containing the player, or empty if not online
    • getPlayer

      Optional<? extends ClusterPlayer> getPlayer(UUID uniqueId)
      Looks up a player by UUID across the cluster.
      Parameters:
      uniqueId - the player's UUID
      Returns:
      an optional containing the player, or empty if not online
    • isPlayerOnline

      boolean isPlayerOnline(String username)
      Checks whether a player with the given username is online anywhere in the cluster.
      Parameters:
      username - the player's username (case-insensitive)
      Returns:
      true if the player is online
    • getPlayerNames

      Collection<String> getPlayerNames()
      Gets the usernames of all players connected across the cluster.
      Returns:
      a collection of player usernames
    • broadcastAlert

      void broadcastAlert(Component message)
      Broadcasts an alert message to all players on all proxies in the cluster.
      Parameters:
      message - the message to broadcast