geforkt von Mirrors/Paper
fb2c24b36d
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: 05ae036c PR-746: Add option to use cached map color palette 57849c1b PR-759: Add preview chat option in ServerListPingEvent 0169e65d PR-758: Add missing server properties methods from 1.19 CraftBukkit Changes: 622dbe6c2 SPIGOT-7068: SKULK and SKULK_VEIN BlockSpreadEvents Still do not reference the correct source (SKULK_CATALYST) 6c61b73f3 PR-1052: Add option to use cached map color palette c882f38ea SPIGOT-7066: Fix custom END worlds not generating DragonBattle 6866aab59 SPIGOT-2420: Can't set exp drops for EnderDragon death 9dcd46530 PR-1067: Add preview chat option in ServerListPingEvent 36c2681af PR-1066: Add missing server properties methods from 1.19 031eaadd0 Increase outdated build delay 8fda4b12f SPIGOT-7060: SCULK and SCULK_VEIN BlockSpreadEvents do not reference the correct source
41 Zeilen
1.7 KiB
Diff
41 Zeilen
1.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Thu, 22 Mar 2018 01:40:24 -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/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index a9731e89f2cddc2ae256bf955945f4d2f3cd0c28..53834d226cf577413d1514c54f5a4b0294a432e7 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -1704,6 +1704,25 @@ public final class CraftServer implements Server {
|
|
return recipients.size();
|
|
}
|
|
|
|
+ // Paper start
|
|
+ @Nullable
|
|
+ public UUID getPlayerUniqueId(String name) {
|
|
+ Player player = Bukkit.getPlayerExact(name);
|
|
+ if (player != null) {
|
|
+ return player.getUniqueId();
|
|
+ }
|
|
+ GameProfile profile;
|
|
+ // Only fetch an online UUID in online mode
|
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()) {
|
|
+ profile = console.getProfileCache().get(name).orElse(null);
|
|
+ } else {
|
|
+ // Make an OfflinePlayer using an offline mode UUID since the name has no profile
|
|
+ profile = new GameProfile(UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)), name);
|
|
+ }
|
|
+ return profile != null ? profile.getId() : null;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
@Override
|
|
@Deprecated
|
|
public OfflinePlayer getOfflinePlayer(String name) {
|