Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
27c7749f42
- Re-removes Bukkit#getServerName - This was (hopefully?) only added back for Timings v2. It should be kept in that scope. - Intend to let PlayerViewDistance API slip. Given the scope of the changes in this area it seems best to let this slip past initial release. It can be re-added when there is additional time to focus on it and the changed systems it relies on. If it is fixed prior to release this is implemented as a single shim patch that can be dropped.
62 Zeilen
2.2 KiB
Diff
62 Zeilen
2.2 KiB
Diff
From 9d6cb9777a68d1b778b91e9b4bec65e489b00096 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 24b761fe..de42be5b 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -423,6 +423,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 9b767d7c..9c92517b 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 {
|
|
@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.
|
|
*
|
|
--
|
|
2.21.0
|
|
|