Package one.tranic.t.base.player
Interface Player<C>
public interface Player<C>
-
Method Summary
Modifier and TypeMethodDescription@Nullable StringRetrieves the client brand name associated with the player.Retrieves the host address to which the player is connected.Retrieves the locale associated with the player.@Nullable LocationRetrieves the location associated with the player.longgetPing()Retrieves the latency or ping value for the player in milliseconds.Retrieves the underlying source object associated with this player.Retrieves the unique identifier (UUID) of the player.Retrieves the username of the player.default @Nullable StringgetXUID()Retrieves the Xbox Unique Identifier (XUID) for the player if the player is a Bedrock player.default booleanDetermines whether the player associated with this instance is a Bedrock player.booleanisOnline()Checks whether the player is currently online.booleankick()Removes the player from the server or disconnects the player for an unspecified reason.booleankick(@NotNull net.kyori.adventure.text.Component reason) Disconnects the player from the server with the specified reason.booleanKicks the player from the game or server with a specified reason.default booleansendForm(org.geysermc.cumulus.form.Form form) Sends a form to the player associated with the current instance.default CompletableFuture<Boolean>sendFormAsync(org.geysermc.cumulus.form.Form form) voidsendMessage(@NotNull net.kyori.adventure.text.Component message) Sends a message to the player represented by this instance.voidsendMessage(String message) Sends a text message to the player.
-
Method Details
-
getUsername
String getUsername()Retrieves the username of the player.- Returns:
- the username of the player as a string
-
getUniqueId
UUID getUniqueId()Retrieves the unique identifier (UUID) of the player.- Returns:
- the universally unique identifier (UUID) of the player
-
getXUID
Retrieves the Xbox Unique Identifier (XUID) for the player if the player is a Bedrock player. This method determines whether the player is a Bedrock player and, if so, utilizes theBedrockPlayer.getXUID(UUID)implementation to fetch the XUID.- Returns:
- the XUID as a string if the player is identified as a Bedrock player;
otherwise,
null.
-
getConnectHost
String getConnectHost()Retrieves the host address to which the player is connected.- Returns:
- the connect host as a string.
-
sendForm
default boolean sendForm(org.geysermc.cumulus.form.Form form) Sends a form to the player associated with the current instance. This method utilizes theBedrockPlayerto deliver the form, associating it with the unique identifier (UUID) of the player.- Parameters:
form- the form to be sent to the player; must not be null- Returns:
trueif the form was successfully sent,falseotherwise
-
sendFormAsync
-
isBedrockPlayer
default boolean isBedrockPlayer()Determines whether the player associated with this instance is a Bedrock player. This method utilizes theBedrockPlayer.isBedrockPlayer(UUID)implementation.- Returns:
- true if the player is a Bedrock player; false otherwise.
-
getLocale
Locale getLocale()Retrieves the locale associated with the player.- Returns:
- the locale representing the player's language and regional preferences.
-
getLocation
Retrieves the location associated with the player.- Returns:
- the
Locationof the player if available, ornullif the location is not set.
-
getPing
long getPing()Retrieves the latency or ping value for the player in milliseconds.The ping represents the time taken for data packets to travel from the player to the server and back. It serves as a measure of network latency between the player and the server.
- Returns:
- the ping value in milliseconds
-
isOnline
boolean isOnline()Checks whether the player is currently online.- Returns:
- true if the player is online, otherwise false
-
getClientBrand
Retrieves the client brand name associated with the player.The client brand name typically refers to the branding or specific modification of the client being used by the player (e.g., "vanilla" or a modified client). This method may return null if the client brand is not available or not applicable for the player.
- Returns:
- the client brand name as a string, or null if not available.
-
getSourcePlayer
C getSourcePlayer()Retrieves the underlying source object associated with this player.- Returns:
- the source player object of type C
-
kick
boolean kick()Removes the player from the server or disconnects the player for an unspecified reason.- Returns:
- true if the player was successfully kicked, false otherwise
-
kick
Kicks the player from the game or server with a specified reason.- Parameters:
reason- the message or reason for the kick- Returns:
- true if the player was successfully kicked, false otherwise
-
kick
boolean kick(@NotNull @NotNull net.kyori.adventure.text.Component reason) Disconnects the player from the server with the specified reason.- Parameters:
reason- the reason for disconnecting the player; must not be null- Returns:
- true if the player was successfully disconnected, false otherwise
-
sendMessage
Sends a text message to the player.- Parameters:
message- the message to be sent, must not be null
-
sendMessage
void sendMessage(@NotNull @NotNull net.kyori.adventure.text.Component message) Sends a message to the player represented by this instance.- Parameters:
message- the message to be sent; must not be null
-