Paper/patches/api/0092-getPlayerUniqueId-API.patch
Nassim Jahnke e6f8284125
Updated Upstream (Bukkit/CraftBukkit) (#8270)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
d43a1e72 SPIGOT-2450: Improve scoreboard criteria API, add missing DisplaySlots
9d6e4847 SPIGOT-7122: New Allay Methods from 1.19.1

CraftBukkit Changes:
c379a6b4e SPIGOT-2450: Improve scoreboard criteria API, add missing DisplaySlots
051fcced1 SPIGOT-7122: New Allay Methods from 1.19.1
2022-08-09 09:18:08 +02:00

59 lines
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 22 Mar 2018 01:39:28 -0400
Subject: [PATCH] getPlayerUniqueId API
Gets the unique ID of the player currently known as the specified player name
In Offline Mode, will return an Offline UUID
This is a more performant way to obtain a UUID for a name than loading an OfflinePlayer
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index a452adcbf8657c501ad92f4cb361b551992f128f..908e1aba5257688bb70fbf1ed83d2212305263a1 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -657,6 +657,20 @@ public final class Bukkit {
return server.getPlayer(id);
}
+ // Paper start
+ /**
+ * Gets the unique ID of the player currently known as the specified player name
+ * In Offline Mode, will return an Offline UUID
+ *
+ * @param playerName the player name to look up the unique ID for
+ * @return A UUID, or null if that player name is not registered with Minecraft and the server is in online mode
+ */
+ @Nullable
+ public static UUID getPlayerUniqueId(@NotNull String playerName) {
+ return server.getPlayerUniqueId(playerName);
+ }
+ // Paper end
+
/**
* Gets the plugin manager for interfacing with plugins.
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index e90056341407f58ff6ce2d9b80c8f3f64464e650..b0e6446c0dc49088878d7ae453dc3eee8b346f4e 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -559,6 +559,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@Nullable
public Player getPlayer(@NotNull UUID id);
+ // Paper start
+ /**
+ * Gets the unique ID of the player currently known as the specified player name
+ * In Offline Mode, will return an Offline UUID
+ *
+ * @param playerName the player name to look up the unique ID for
+ * @return A UUID, or null if that player name is not registered with Minecraft and the server is in online mode
+ */
+ @Nullable
+ public UUID getPlayerUniqueId(@NotNull String playerName);
+ // Paper end
+
/**
* Gets the plugin manager for interfacing with plugins.
*