2021-06-11 14:02:28 +02:00
|
|
|
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
|
2021-10-05 05:14:11 +02:00
|
|
|
index e5515d68b6d69816e29faf1c6d6babe94918b63b..7a5ed3f1ff00ac689f570cd8c02fbd6c7beb7f44 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
2021-10-05 05:14:11 +02:00
|
|
|
@@ -550,6 +550,20 @@ public final class Bukkit {
|
2021-06-11 14:02:28 +02:00
|
|
|
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
|
2021-10-05 05:14:11 +02:00
|
|
|
index d442ba16abfb096817a2be584a596bf6536b070e..87690bd58bdab40edcfddc40b26acc8e1f8cf8fc 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
2021-10-05 05:14:11 +02:00
|
|
|
@@ -470,6 +470,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
2021-06-11 14:02:28 +02:00
|
|
|
@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.
|
|
|
|
*
|