spigot/CraftBukkit-Patches/0072-Only-fetch-an-online-UUID-in-online-mode.patch

38 lines
1.7 KiB
Diff
Raw Normal View History

2023-06-08 01:30:00 +10:00
From 80583ee76b6b168cf3248e11cdd9f8192c8085de Mon Sep 17 00:00:00 2001
From: Maxim Van de Wynckel <maxim_vdw@hotmail.com>
Date: Wed, 30 Jul 2014 01:19:51 +0200
Subject: [PATCH] Only fetch an online UUID in online mode
The previous code would get an online UUID even in offline mode that
breaks plugins if the player joins.
Example:
You want to store data for player "Test" who never joined. An online UUID is created and you save it using that UUID.
The player Test joins with an offline UUID but that will not match the online UUID of the saved data.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2023-06-08 01:30:00 +10:00
index 9362f6765..b107e26a7 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2023-06-08 01:30:00 +10:00
@@ -1660,8 +1660,14 @@ public final class CraftServer implements Server {
OfflinePlayer result = getPlayerExact(name);
if (result == null) {
- // This is potentially blocking :(
2021-11-22 09:00:00 +11:00
- GameProfile profile = console.getProfileCache().get(name).orElse(null);
+ // Spigot Start
+ GameProfile profile = null;
+ // Only fetch an online UUID in online mode
2019-04-23 15:12:43 +10:00
+ if ( getOnlineMode() || org.spigotmc.SpigotConfig.bungee )
+ {
2021-11-22 09:00:00 +11:00
+ profile = console.getProfileCache().get(name).orElse(null);
+ }
+ // Spigot end
if (profile == null) {
// Make an OfflinePlayer using an offline mode UUID since the name has no profile
result = getOfflinePlayer(new GameProfile(UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)), name));
--
2023-05-25 07:31:10 +10:00
2.40.1