Paper/Spigot-API-Patches/0088-getPlayerUniqueId-API.patch
Zach Brown dcebe229b5
Update upstream B/CB/S
--- work/Bukkit
Submodule work/Bukkit 1627782b..67e91ef7:
  > Fix some incorrectly handled JavaDoc
  > SPIGOT-4478: Update PlayerLoginEvent docs
  > Add API to manipulate boss bar of entities and those created by commands

--- work/CraftBukkit
Submodule work/CraftBukkit ca22de36..3a911828:
  > SPIGOT-4477: Arrows only firing direction of boat
  > SPIGOT-4478: NPE during PlayerLoginEvent recipe manipulation
  > Add API to manipulate boss bar of entities and those created by commands

--- work/Spigot
Submodule work/Spigot 2474d93d..947a8e7f:
  > Rebuild patches
2018-11-11 00:37:59 -05:00

62 lines
2.1 KiB
Diff

From 8ddad2ac0889f686038b73a4b10aaf8a3a6333fc 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 02e7d118..233a7154 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -431,6 +431,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(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 9e7bc162..b8076fc3 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -361,6 +361,18 @@ public interface Server extends PluginMessageRecipient {
*/
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.
*
--
2.19.1