Package com.btcvelocity.api.cluster
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 Summary
Modifier and TypeMethodDescriptionvoidbroadcastAlert(Component message) Broadcasts an alert message to all players on all proxies in the cluster.Collection<? extends ClusterPlayer> Gets all players connected anywhere in the cluster.Optional<? extends ClusterPlayer> Looks up a player by username across the cluster.Optional<? extends ClusterPlayer> Looks up a player by UUID across the cluster.Gets the usernames of all players connected across the cluster.Collection<? extends ClusterPlayer> getPlayersOnProxy(String proxyId) Gets all players connected to the specified proxy.default Collection<? extends ClusterPlayer> getPlayersOnServer(RegisteredServer server) Gets all players currently on the specified backend server.Collection<? extends ClusterPlayer> getPlayersOnServer(String serverName) Gets all players currently on the specified backend server.default intGets the number of players currently on the specified backend server.intgetPlayersOnServerCount(String serverName) Gets the number of players currently on the specified backend server.intGets the total number of players connected across all proxies.booleanisPlayerOnline(String username) Checks whether a player with the given username is online anywhere in the cluster.
-
Method Details
-
getTotalPlayerCount
int getTotalPlayerCount()Gets the total number of players connected across all proxies.- Returns:
- the cluster-wide player count
-
getPlayersOnServerCount
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
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
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
Gets all players currently on the specified backend server.- Parameters:
server- the backend server- Returns:
- an unmodifiable collection of players on that server
-
getPlayersOnProxy
Gets all players connected to the specified proxy.- Parameters:
proxyId- the proxy identifier- Returns:
- an unmodifiable collection of players on that proxy
-
getPlayer
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
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
Checks whether a player with the given username is online anywhere in the cluster.- Parameters:
username- the player's username (case-insensitive)- Returns:
trueif 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
Broadcasts an alert message to all players on all proxies in the cluster.- Parameters:
message- the message to broadcast
-