Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-17 13:30:06 +01:00
a8c28e1920
This branch/commit is only useful to those who purely use a clean Bukkit/Spigot/Paper API and does not use NMS/OBC references. This will let you start updating your plugin to the latest 1.13 builds of Bukkit Preview (4 as of now) Note that this release is not final!!! API breakages may occur! It is up to you if you find use out of this work.
62 Zeilen
2.1 KiB
Diff
62 Zeilen
2.1 KiB
Diff
From 154ed7732b789705984e91d137eb41bd27e6857e 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 01a226d9..b389677a 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -426,6 +426,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 e7aab4bb..17ac4241 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -356,6 +356,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.18.0
|
|
|