geforkt von Mirrors/Paper
3aae7ef01a
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: 214b9f14 SPIGOT-6605: Add method to access value of enforce-whitelist CraftBukkit Changes: b121d3b9 SPIGOT-6605: Add method to access value of enforce-whitelist
59 Zeilen
2.3 KiB
Diff
59 Zeilen
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 baf0a417970b95d5d9c057f252f4d37d13ad8ddb..8fd87b32b5e80548bc62bb71ab36db142e7aa38a 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -528,6 +528,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 df66b39ce9f3dd6c567bc71bacfd0b105c2e0e8d..021f656dce58cc61883604411e219bd627f54d21 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -449,6 +449,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.
|
|
*
|