Paper/CraftBukkit-Patches/0127-Only-fetch-an-online-UUID-in-online-mode.patch

38 lines
1.7 KiB
Diff
Raw Normal View History

2016-03-01 01:23:45 +01:00
From 249003af99a25a9fbad7dbba89b7b3fe01dbf5f7 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
2016-02-29 22:33:06 +01:00
index 8900e01..cabb3e5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2016-02-29 22:33:06 +01:00
@@ -1296,8 +1296,14 @@ public final class CraftServer implements Server {
OfflinePlayer result = getPlayerExact(name);
if (result == null) {
- // This is potentially blocking :(
2016-02-29 22:33:06 +01:00
- GameProfile profile = console.getUserCache().getProfile(name);
+ // Spigot Start
+ GameProfile profile = null;
+ // Only fetch an online UUID in online mode
+ if ( MinecraftServer.getServer().getOnlineMode() || org.spigotmc.SpigotConfig.bungee )
+ {
2016-02-29 22:33:06 +01:00
+ profile = console.getUserCache().getProfile( name );
+ }
+ // 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));
--
2016-02-29 22:33:06 +01:00
2.5.0