Class BedrockPlayer

java.lang.Object
one.tranic.t.base.player.BedrockPlayer

public class BedrockPlayer extends Object
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    BedrockPlayer(@NotNull Player player)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Retrieves the client ID of the Bedrock player.
    @Nullable String
    Retrieves the device ID of the Bedrock player.
    @Nullable String
    Retrieves the device model associated with the Bedrock player.
    boolean
    form(@NotNull org.geysermc.cumulus.form.Form form)
    Sends a form to a Bedrock player if applicable.
    static boolean
    Checks if the Floodgate integration is active.
    static boolean
    Checks if there is a Geyser instance available.
    @Nullable String
    Determines the input mode used by the Bedrock player, if applicable.
    static boolean
    Determines whether the specified player, identified by their UUID, is a Bedrock player.
    boolean
    Determines if the current player is a Floodgate player.
    static boolean
    Checks if a given UUID string represents a Floodgate player by verifying if it starts with the Floodgate UUID prefix.
    static boolean
    Determines if a player with the given UUID is a Floodgate player.
    of(@NotNull Player player)
    Creates a new BedrockPlayer instance from the provided Player.
    long
    Retrieves the ping value of a Bedrock player if applicable.
    @NonNull String
    Determines the platform type of the player.
    @NotNull Player
    Retrieves the associated player instance.
    int
    Retrieves the subscription ID of the current Bedrock player instance if available.
    @Nullable String
    Retrieves the XUID (Xbox User ID) of the Bedrock player.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BedrockPlayer

      protected BedrockPlayer(@NotNull @NotNull Player player)
  • Method Details

    • of

      public static BedrockPlayer of(@NotNull @NotNull Player player)
      Creates a new BedrockPlayer instance from the provided Player.
      Parameters:
      player - the Player to convert to a BedrockPlayer; must not be null
      Returns:
      a new BedrockPlayer instance associated with the given Player
    • isBedrockPlayer

      public static boolean isBedrockPlayer(UUID uuid)
      Determines whether the specified player, identified by their UUID, is a Bedrock player.
      Parameters:
      uuid - the universally unique identifier (UUID) of the player to check
      Returns:
      true if the specified player is a Bedrock player, otherwise false
    • isFloodgatePlayer

      public static boolean isFloodgatePlayer(String uuid)
      Checks if a given UUID string represents a Floodgate player by verifying if it starts with the Floodgate UUID prefix.
      Parameters:
      uuid - the UUID string of the player, expected to contain dashes and not null
      Returns:
      true if the UUID represents a Floodgate player, false otherwise
    • isFloodgatePlayer

      public static boolean isFloodgatePlayer(UUID uuid)
      Determines if a player with the given UUID is a Floodgate player.
      Parameters:
      uuid - the universally unique identifier (UUID) of the player to check
      Returns:
      true if the player is a Floodgate player, false otherwise
    • hasGeyser

      public static boolean hasGeyser()
      Checks if there is a Geyser instance available.
      Returns:
      true if a Geyser instance is available; false otherwise
    • hasFloodgate

      public static boolean hasFloodgate()
      Checks if the Floodgate integration is active.
      Returns:
      true if Floodgate is enabled, false otherwise
    • player

      @NotNull public @NotNull Player player()
      Retrieves the associated player instance.
      Returns:
      the Player instance associated with this object; never null
    • isFloodgatePlayer

      public boolean isFloodgatePlayer()
      Determines if the current player is a Floodgate player.

      A Floodgate player is a Bedrock player connected through the Floodgate plugin.

      Returns:
      true if the player is a Floodgate player, false otherwise
    • platform

      public @NonNull String platform()
      Determines the platform type of the player.
      Returns:
      the platform type of the player as a non-null string. Possible values include specific platform names from Floodgate or Geyser, or "Java Edition" for non-Bedrock players.
    • subscribeId

      public int subscribeId()
      Retrieves the subscription ID of the current Bedrock player instance if available.

      The method checks whether the player is a Floodgate player and returns their associated subscription ID. If the player is not a Floodgate player or the Bedrock player instance is null, it returns -1.

      Returns:
      the subscription ID of the Floodgate player, or -1 if unavailable
    • deviceId

      public @Nullable String deviceId()
      Retrieves the device ID of the Bedrock player.

      If the player is a Bedrock player and Geyser is enabled, this method fetches the device ID associated with the player's session.

      Returns:
      the device ID of the player, or null if the player is not a Bedrock player, Geyser is not enabled, or if the device ID is unavailable
    • deviceModel

      public @Nullable String deviceModel()
      Retrieves the device model associated with the Bedrock player.

      If the player is a Bedrock player and the Geyser integration is available, this method fetches the device model from the client's data.

      Returns:
      the device model of the Bedrock player as a string, or null if unavailable
    • inputMode

      public @Nullable String inputMode()
      Determines the input mode used by the Bedrock player, if applicable.

      The input mode can vary based on the Bedrock player's connection and settings, such as Floodgate or Geyser integration.

      Returns:
      a string representation of the input mode if the Bedrock player is connected via Floodgate or Geyser; otherwise, returns null if the input mode cannot be determined or is not applicable.
    • clientID

      public long clientID()
      Retrieves the client ID of the Bedrock player.

      This method checks if the player instance is associated with Bedrock through Geyser. If so, it fetches the client random ID from the Geyser session. If the player is not a Bedrock player or the Geyser instance is not available, it returns a default value of -1.

      Returns:
      the client ID as a long if the player is a Geyser Bedrock player; -1 otherwise
    • xuid

      public @Nullable String xuid()
      Retrieves the XUID (Xbox User ID) of the Bedrock player.

      The method checks if the player is associated with Floodgate or Geyser and retrieves the XUID accordingly.

      Returns:
      the XUID of the Bedrock player as a string, or null if unavailable
    • form

      public boolean form(@NotNull @NotNull org.geysermc.cumulus.form.Form form)
      Sends a form to a Bedrock player if applicable.

      The form will be sent through Floodgate or Geyser, depending on the player's platform.

      Parameters:
      form - the form to be sent to the player; must not be null
      Returns:
      true if the form was successfully sent; false otherwise
    • ping

      public long ping()
      Retrieves the ping value of a Bedrock player if applicable.

      This method checks if the associated player is a Bedrock player and if the Geyser integration is available.

      Returns:
      the ping value in milliseconds for a Bedrock player, or -1 if the player is not a Bedrock player or Geyser is not available.