Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-17 03:50:08 +01:00
773dd72446
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: 69c7ce23 PR-990: Use Mockito instead of InvocationHandler for test mocking 997de31d PR-893: Add a stream method to Registry to make it easier to use and to avoid unnecessary wrapping 6a8ce581 Fix malformed javadoc in previous commit 26c74f6d PR-890: Add more Sculk API (bloom, shriek, bloom event) aa067abf PR-895: Load GameEvent and MusicInstrument from registry CraftBukkit Changes: 78796c9de Add support for Java 21 ddc9a2dad SPIGOT-7475: Don't fire SculkBloomEvent during world generation caee2311a PR-1245: Add a stream method to Registry to make it easier to use and to avoid unnecessary wrapping de421cf56 PR-1242: Add more Sculk API (bloom, shriek, bloom event) 00f5a80fb PR-1252: Fix error when generating a tree in water 10219df3a PR-1248: Load GameEvent and MusicInstrument from registry
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 95e08874f993c826839184fa894f82d07224cb12..e19ddd1ab4d15ee041c74bb3767e3a9c41072f34 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -1727,6 +1727,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) {
|