geforkt von Mirrors/Paper
1cfd363d32
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: fc460d1b PR-735: Add Villager#zombify c8c8331e PR-690: Add method to read ItemStack input 62845f2f SPIGOT-6829: Add per-player world border API CraftBukkit Changes: a459f4d4 PR-1033: Add Villager#zombify d65d1430 PR-975: Add method to read ItemStack input b5559f8c SPIGOT-6990: Fix setRepairCost(0) in Anvil 6c308e1b SPIGOT-6829: Add per-player world border API Spigot Changes: 42b61526 SPIGOT-7000: Generation and /locate issues when using custom structure seeds
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 9278bc9a3e29cbdf268049c601d42d0b2b9aed11..9ef4ba665c4f8abaf7ccefa254e15fa11e814fc9 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -1705,6 +1705,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 (com.destroystokyo.paper.PaperConfig.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) {
|