Interface Player<C>


public interface Player<C>
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable String
    Retrieves the client brand name associated with the player.
    @NotNull String
    Retrieves the host address to which the player is connected.
    @NotNull Locale
    Retrieves the locale associated with the player.
    @Nullable Location
    Retrieves the location associated with the player.
    long
    Retrieves the latency or ping value for the player in milliseconds.
    static @Nullable Player<?>
    getPlayer(@NotNull String name)
     
    static @Nullable Player<?>
    getPlayer(@NotNull UUID uuid)
     
    default int
    Retrieves the protocol version of the player.
    default @NotNull one.tranic.t.utils.ProtocolVersion
    Retrieves the protocol version of the player.
    Retrieves the underlying source object associated with this player.
    @NotNull UUID
    Retrieves the unique identifier (UUID) of the player.
    @NotNull String
    Retrieves the username of the player.
    default @Nullable String
    Retrieves the Xbox Unique Identifier (XUID) for the player if the player is a Bedrock player.
    default boolean
    Determines whether the player associated with this instance is a Bedrock player.
    boolean
    Checks whether the player is currently online.
    boolean
    Removes the player from the server or disconnects the player for an unspecified reason.
    boolean
    kick(@NotNull net.kyori.adventure.text.Component reason)
    Disconnects the player from the server with the specified reason.
    boolean
    kick(@Nullable String reason)
    Kicks the player from the game or server with a specified reason.
    default boolean
    sendForm(@NotNull org.geysermc.cumulus.form.Form form)
    Sends a form to the player associated with the current instance.
    default @NotNull CompletableFuture<Boolean>
    sendFormAsync(@NotNull org.geysermc.cumulus.form.Form form)
     
    void
    sendMessage(@NotNull String message)
    Sends a text message to the player.
    void
    sendMessage(@NotNull net.kyori.adventure.text.Component message)
    Sends a message to the player represented by this instance.
  • Method Details

    • getPlayer

      @Nullable static @Nullable Player<?> getPlayer(@NotNull @NotNull String name)
    • getPlayer

      @Nullable static @Nullable Player<?> getPlayer(@NotNull @NotNull UUID uuid)
    • getUsername

      @NotNull @NotNull String getUsername()
      Retrieves the username of the player.
      Returns:
      the username of the player as a string
    • getUniqueId

      @NotNull @NotNull UUID getUniqueId()
      Retrieves the unique identifier (UUID) of the player.
      Returns:
      the universally unique identifier (UUID) of the player
    • getXUID

      @Nullable default @Nullable String 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 the BedrockPlayer.getXUID(UUID) implementation to fetch the XUID.
      Returns:
      the XUID as a string if the player is identified as a Bedrock player; otherwise, null.
    • getPlayerProtocolVersion

      default int getPlayerProtocolVersion()
      Retrieves the protocol version of the player.

      For Bedrock players, the method returns -1 as they do not use protocol versions.

      For non-Bedrock players, the method fetches their protocol version using ViaPlayer.

      Returns:
      the protocol version of the player as an integer, or -1 if the player is a Bedrock player
    • getPlayerVersion

      @NotNull default @NotNull one.tranic.t.utils.ProtocolVersion getPlayerVersion()
      Retrieves the protocol version of the player.

      This method determines the player's protocol version based on:

      - If the player is a Bedrock player, the protocol version will be ProtocolVersion.UNKNOWN.

      - Otherwise, it uses the ViaPlayer.getVersion(UUID) implementation to fetch the protocol version based on the player's unique identifier (UUID).

      Returns:
      the player's protocol version as a ProtocolVersion instance.
    • getConnectedHost

      @NotNull @NotNull String getConnectedHost()
      Retrieves the host address to which the player is connected.
      Returns:
      the connected host as a string.
    • sendForm

      default boolean sendForm(@NotNull @NotNull org.geysermc.cumulus.form.Form form)
      Sends a form to the player associated with the current instance. This method utilizes the BedrockPlayer to 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:
      true if the form was successfully sent, false otherwise
    • sendFormAsync

      @NotNull default @NotNull CompletableFuture<Boolean> sendFormAsync(@NotNull @NotNull org.geysermc.cumulus.form.Form form)
    • isBedrockPlayer

      default boolean isBedrockPlayer()
      Determines whether the player associated with this instance is a Bedrock player. This method utilizes the BedrockPlayer.isBedrockPlayer(UUID) implementation.
      Returns:
      true if the player is a Bedrock player; false otherwise.
    • getLocale

      @NotNull @NotNull Locale getLocale()
      Retrieves the locale associated with the player.
      Returns:
      the locale representing the player's language and regional preferences.
    • getLocation

      @Nullable @Nullable Location getLocation()
      Retrieves the location associated with the player.
      Returns:
      the Location of the player if available, or null if 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

      @Nullable @Nullable String 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

      @Nullable 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

      boolean kick(@Nullable @Nullable String reason)
      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

      void sendMessage(@NotNull @NotNull String message)
      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