Package com.btcvelocity.api.cluster
Interface ClusterPlayer
public interface ClusterPlayer
Represents a player connected somewhere in the proxy cluster.
Provides read-only identity information (UUID, username, proxy, server) and remote actions (kick, message, move, etc.) that are dispatched to whichever proxy currently owns the player's session.
-
Method Summary
Modifier and TypeMethodDescription@Nullable StringGets the player's IP address.Gets the identifier of the proxy this player is connected to.@Nullable StringGets the name of the backend server this player is currently on.Gets the player's unique identifier.Gets the player's username.booleanChecks whether this player allows themselves to be listed in the tab list for other players.voidKicks the player from the proxy with the given reason.voidMoves the player to the specified backend server.Queries the player's current ping latency.voidsendMessage(Component message) Sends a chat message to the player.voidForces the player to execute a command or send a chat message.Attempts to resolve this cluster player to a localPlayerinstance on the current proxy.Transfers the player to a different proxy at the given address.
-
Method Details
-
getUniqueId
UUID getUniqueId()Gets the player's unique identifier.- Returns:
- the player's UUID
-
getUsername
String getUsername()Gets the player's username.- Returns:
- the player's username
-
getProxyId
String getProxyId()Gets the identifier of the proxy this player is connected to.- Returns:
- the proxy identifier
-
getServerName
Gets the name of the backend server this player is currently on.- Returns:
- the server name, or
nullif the player has not yet been sent to a server
-
getIpAddress
Gets the player's IP address.- Returns:
- the IP address string, or
nullif unavailable
-
isClientListingAllowed
boolean isClientListingAllowed()Checks whether this player allows themselves to be listed in the tab list for other players.- Returns:
trueif the player allows client listing
-
kick
Kicks the player from the proxy with the given reason.- Parameters:
reason- the kick reason displayed to the player
-
sudo
Forces the player to execute a command or send a chat message.- Parameters:
command- the command (with or without leading/) or chat message
-
move
Moves the player to the specified backend server.- Parameters:
targetServer- the name of the target server
-
transfer
Transfers the player to a different proxy at the given address.- Parameters:
ip- the target proxy's IP addressport- the target proxy's port- Returns:
- a future that completes with
trueif the transfer was initiated
-
sendMessage
Sends a chat message to the player.- Parameters:
message- the message to send
-
queryPing
CompletableFuture<Long> queryPing()Queries the player's current ping latency.- Returns:
- a future that completes with the player's ping in milliseconds
-
toLocalPlayer
Attempts to resolve this cluster player to a localPlayerinstance on the current proxy.- Returns:
- an optional containing the local player, or empty if the player is on a different proxy
-