2020-05-06 09:48:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-03-22 05:41:44 +00: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
|
2021-02-21 19:45:33 +00:00
|
|
|
index f5d3a7370390871d1b6075f32846d1a942b05b7f..2d7f8e128e23934a8fe26baf19198b7ffc8447bb 100644
|
2018-03-22 05:41:44 +00:00
|
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
2021-02-21 19:45:33 +00:00
|
|
|
@@ -504,6 +504,20 @@ public final class Bukkit {
|
2018-03-22 05:41:44 +00: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
|
2019-03-20 00:28:15 +00:00
|
|
|
+ public static UUID getPlayerUniqueId(@NotNull String playerName) {
|
2018-03-22 05:41:44 +00:00
|
|
|
+ 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-02-21 19:45:33 +00:00
|
|
|
index 38d138b217734e598581ed14065ff2015135ee9a..01657abaff86cf7bb3ffb857024c5032781b8660 100644
|
2018-03-22 05:41:44 +00:00
|
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
2021-02-21 19:45:33 +00:00
|
|
|
@@ -429,6 +429,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
2019-03-20 00:28:15 +00:00
|
|
|
@Nullable
|
|
|
|
public Player getPlayer(@NotNull UUID id);
|
2018-03-22 05:41:44 +00:00
|
|
|
|
|
|
|
+ // 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
|
2019-03-20 00:28:15 +00:00
|
|
|
+ public UUID getPlayerUniqueId(@NotNull String playerName);
|
2018-03-22 05:41:44 +00:00
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Gets the plugin manager for interfacing with plugins.
|
|
|
|
*
|