2015-07-23 20:43:27 +00:00
|
|
|
From 51e9c510d10f76c98058aebb0aa2e2c408141243 Mon Sep 17 00:00:00 2001
|
2014-07-30 08:39:03 +00: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
|
2015-07-23 20:43:27 +00:00
|
|
|
index e0fb365..e151098 100644
|
2014-07-30 08:39:03 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2015-07-23 20:43:27 +00:00
|
|
|
@@ -1289,8 +1289,14 @@ public final class CraftServer implements Server {
|
2014-08-01 00:16:47 +00:00
|
|
|
|
2014-07-30 08:39:03 +00:00
|
|
|
OfflinePlayer result = getPlayerExact(name);
|
|
|
|
if (result == null) {
|
|
|
|
- // This is potentially blocking :(
|
|
|
|
- GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(name);
|
|
|
|
+ // Spigot Start
|
|
|
|
+ GameProfile profile = null;
|
|
|
|
+ // Only fetch an online UUID in online mode
|
|
|
|
+ if ( MinecraftServer.getServer().getOnlineMode() || org.spigotmc.SpigotConfig.bungee )
|
|
|
|
+ {
|
|
|
|
+ profile = MinecraftServer.getServer().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));
|
2014-08-01 00:16:47 +00:00
|
|
|
--
|
2015-05-09 20:23:26 +00:00
|
|
|
2.1.4
|
2014-08-01 00:16:47 +00:00
|
|
|
|