2019-01-01 04:15:55 +01:00
|
|
|
From e1d2e8f216b7fda9a9c87aa3540e2b73307a19d7 Mon Sep 17 00:00:00 2001
|
2018-03-22 06:41:44 +01:00
|
|
|
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
|
2018-11-11 06:37:15 +01:00
|
|
|
index 02e7d118..233a7154 100644
|
2018-03-22 06:41:44 +01:00
|
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
2018-11-11 06:37:15 +01:00
|
|
|
@@ -431,6 +431,20 @@ public final class Bukkit {
|
2018-03-22 06:41:44 +01: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(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
|
2018-11-11 06:37:15 +01:00
|
|
|
index 9e7bc162..b8076fc3 100644
|
2018-03-22 06:41:44 +01:00
|
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
2018-11-11 06:37:15 +01:00
|
|
|
@@ -361,6 +361,18 @@ public interface Server extends PluginMessageRecipient {
|
2018-03-22 06:41:44 +01:00
|
|
|
*/
|
|
|
|
public Player getPlayer(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(String playerName);
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Gets the plugin manager for interfacing with plugins.
|
|
|
|
*
|
|
|
|
--
|
2019-01-01 04:15:55 +01:00
|
|
|
2.20.1
|
2018-03-22 06:41:44 +01:00
|
|
|
|