2021-10-10 08:18:54 +11:00
|
|
|
From f328803ac8e9109ed63678c0b0c569c176e5d724 Mon Sep 17 00:00:00 2001
|
2014-07-30 17:08:36 +10:00
|
|
|
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
|
2021-10-05 12:35:38 +11:00
|
|
|
index b06039333..31de5ec1f 100644
|
2014-07-30 17:08:36 +10:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2021-10-05 12:35:38 +11:00
|
|
|
@@ -1605,8 +1605,14 @@ public final class CraftServer implements Server {
|
2014-07-30 17:08:36 +10:00
|
|
|
|
|
|
|
OfflinePlayer result = getPlayerExact(name);
|
|
|
|
if (result == null) {
|
|
|
|
- // This is potentially blocking :(
|
2021-07-07 00:00:00 +10:00
|
|
|
- GameProfile profile = console.getUserCache().getProfile(name).orElse(null);
|
2014-07-30 17:08:36 +10:00
|
|
|
+ // 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 )
|
2014-07-30 17:08:36 +10:00
|
|
|
+ {
|
2021-07-07 00:00:00 +10:00
|
|
|
+ profile = console.getUserCache().getProfile(name).orElse(null);
|
2014-07-30 17:08:36 +10:00
|
|
|
+ }
|
|
|
|
+ // 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));
|
|
|
|
--
|
2020-05-09 18:48:11 +10:00
|
|
|
2.25.1
|
2014-07-30 17:08:36 +10:00
|
|
|
|