Class Floodgate

java.lang.Object
com.ranull.graves.integration.Floodgate

public class Floodgate extends Object
Integration class for the Floodgate API.

Handles detection and interaction with Bedrock players connecting via Geyser and Floodgate on Java servers.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final org.geysermc.floodgate.api.FloodgateApi
    Reference to the Floodgate API.
    private final Graves
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Floodgate(Graves plugin)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the Java-corrected unique UUID for the given UUID.
    getCorrectUniqueId(org.bukkit.entity.Player player)
    Retrieves the normalized (Java-style) UUID for a given player.
    getCorrectUsername(org.bukkit.entity.Player player)
    Deprecated.
    Use UUIDs for any identity-related logic.
    getNormalizedUUID(org.bukkit.entity.Player player)
    Gets a normalized UUID for comparison across Java and Bedrock players.
    org.geysermc.floodgate.api.player.FloodgatePlayer
    Retrieves the Floodgate player instance for the given UUID.
    org.geysermc.floodgate.api.player.FloodgatePlayer
    getPlayer(org.bukkit.entity.Player player)
    Retrieves the Floodgate player instance for the given player.
    boolean
    isBedrockPlayer(org.bukkit.entity.Player player)
    Checks if the given player is a Bedrock (Floodgate) player.
    boolean
    Checks if the given UUID is a Floodgate-specific ID.
    boolean
    isFloodgateId(org.bukkit.entity.Player player)
    Checks if the given player is identified by a Floodgate-specific UUID.

    Methods inherited from class java.lang.Object

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

    • plugin

      private final Graves plugin
    • floodgateApi

      private final org.geysermc.floodgate.api.FloodgateApi floodgateApi
      Reference to the Floodgate API.
  • Constructor Details

    • Floodgate

      public Floodgate(Graves plugin)
  • Method Details

    • isBedrockPlayer

      public boolean isBedrockPlayer(org.bukkit.entity.Player player)
      Checks if the given player is a Bedrock (Floodgate) player.
      Parameters:
      player - the player to check
      Returns:
      true if the player is a Bedrock client, false otherwise
    • isFloodgateId

      public boolean isFloodgateId(org.bukkit.entity.Player player)
      Checks if the given player is identified by a Floodgate-specific UUID.
      Parameters:
      player - the player to check
      Returns:
      true if the player's UUID is a Floodgate ID, false otherwise
    • isFloodgateId

      public boolean isFloodgateId(UUID uuid)
      Checks if the given UUID is a Floodgate-specific ID.
      Parameters:
      uuid - the UUID to check
      Returns:
      true if the UUID belongs to a Bedrock player, false otherwise
    • getPlayer

      public org.geysermc.floodgate.api.player.FloodgatePlayer getPlayer(org.bukkit.entity.Player player)
      Retrieves the Floodgate player instance for the given player.
      Parameters:
      player - the Bukkit player
      Returns:
      the Floodgate player instance, or null if not a Bedrock player
    • getPlayer

      public org.geysermc.floodgate.api.player.FloodgatePlayer getPlayer(UUID uuid)
      Retrieves the Floodgate player instance for the given UUID.
      Parameters:
      uuid - the UUID of the player
      Returns:
      the Floodgate player instance, or null if not found
    • getNormalizedUUID

      public UUID getNormalizedUUID(org.bukkit.entity.Player player)
      Gets a normalized UUID for comparison across Java and Bedrock players.

      If the player is a Bedrock client, this returns the Java-style UUID Floodgate maps them to. Otherwise, returns their Bukkit UUID.

      Parameters:
      player - the player
      Returns:
      a UUID that can be used for consistent ownership checks
    • getCorrectUsername

      @Deprecated public String getCorrectUsername(org.bukkit.entity.Player player)
      Deprecated.
      Use UUIDs for any identity-related logic. This method should only be used for display/UI.
      Gets the Java-style username for a player.

      For Bedrock players, this will return the username Floodgate assigns for use in Java context. For Java players, this returns the actual Bukkit name. ⚠️ DEPRECATED: Do not use usernames for identity comparisons.
      Usernames are not unique or stable across both Java and Bedrock. Use getNormalizedUUID(Player) instead.

      Parameters:
      player - the player
      Returns:
      the correct Java-style username for display purposes only
    • getCorrectUniqueId

      public UUID getCorrectUniqueId(org.bukkit.entity.Player player)
      Retrieves the normalized (Java-style) UUID for a given player.

      If the player is a Bedrock client connecting through Floodgate, this returns the UUID that Floodgate maps to for consistent identity tracking. Otherwise, returns the player's original Bukkit UUID.

      Parameters:
      player - the player to normalize
      Returns:
      the correct UUID representing the player in Java context
    • getCorrectUniqueId

      public UUID getCorrectUniqueId(UUID uuid)
      Gets the Java-corrected unique UUID for the given UUID.

      If the UUID belongs to a Floodgate (Bedrock) player, this will return the mapped Java UUID. If not, the original UUID is returned.

      Parameters:
      uuid - the UUID to normalize
      Returns:
      the Java UUID if Bedrock, or the original UUID