Class PlayerUUIDs

java.lang.Object
com.cryptomorin.xseries.profiles.PlayerUUIDs

@Internal public final class PlayerUUIDs extends Object
  • Field Details

    • IDENTITY_UUID

      public static final UUID IDENTITY_UUID
      Used as the default UUID for GameProfiles. Also used as a null-indicating value.
    • OFFLINE_TO_ONLINE

      public static final Map<UUID,UUID> OFFLINE_TO_ONLINE
      We can't use Guava's BiMap here since non-existing players are cached too.
    • ONLINE_TO_OFFLINE

      public static final Map<UUID,UUID> ONLINE_TO_OFFLINE
    • USERNAME_TO_ONLINE

      public static final Map<String,UUID> USERNAME_TO_ONLINE
    • PROXY_ONLINE_MODE_PROPERTY

      public static final String PROXY_ONLINE_MODE_PROPERTY
      System property that overrides usesRealUUIDs() when set to true or false. Useful for setups that the automatic detection cannot figure out (e.g. Spigot behind an offline-mode BungeeCord before any player has joined).
      See Also:
  • Constructor Details

    • PlayerUUIDs

      public PlayerUUIDs()
  • Method Details

    • UUIDFromDashlessString

      public static UUID UUIDFromDashlessString(String dashlessUUIDString)
    • toUndashedUUID

      public static String toUndashedUUID(UUID id)
    • getOfflineUUID

      @NotNull public static @NotNull UUID getOfflineUUID(@NotNull @NotNull String username)
    • isOnlineMode

      public static boolean isOnlineMode()
    • usesRealUUIDs

      public static boolean usesRealUUIDs()
      Whether player identity on this server is based on real, Mojang-authenticated UUIDs.

      This is what code should use instead of isOnlineMode() when deciding which UUID belongs in the server's own records (e.g. the usercache.json user cache). Bukkit.getOnlineMode() is false on every proxied backend, but backends behind an online-mode BungeeCord/Velocity proxy still receive and store real UUIDs. Treating those servers as offline corrupts their user cache with computed offline UUIDs, which breaks name-based lookups (whitelist, bans, other plugins) for the affected players.

      Detection order:

      1. The "xseries.profiles.proxyOnlineMode" system property, if set.
      2. Bukkit.getOnlineMode() being true.
      3. Paper's proxies config (isProxyOnlineMode()), which covers both Velocity and BungeeCord forwarding, on any Paper-based server.
      4. On Spigot behind BungeeCord (settings.bungeecord), the UUID of a currently online player: proxies compute offline UUIDs with the same formula as vanilla, so a player whose UUID doesn't match getOfflineUUID(String) proves the proxy runs in online mode. With no player online the result is assumed offline but not cached, so it's re-evaluated on the next call.
    • getRealUUIDOfPlayer

      @Nullable public static @Nullable UUID getRealUUIDOfPlayer(@NotNull @NotNull String username)
    • getRealUUIDOfPlayer

      @Nullable public static @Nullable UUID getRealUUIDOfPlayer(@NotNull @NotNull String username, @NotNull @NotNull UUID uuid)
      Returns:
      null if a player with this username doesn't exist.