PaperSpigot-Parent/CraftBukkit-Patches/0167-Only-fetch-an-online-UUID-in-online-mode.patch
Zach Brown a4647a8a71 Update from upstream SpigotMC
Fix empty `ench` tags being wiped by the meta system SpigotMC/Spigot@cc9a1a417f
Add Hunger Config Values SpigotMC/Spigot@2cd515e224
Make debug logging togglable SpigotMC/Spigot@d31b1d616f

Spigot has implemented a system of hunger exhaustion similar to ours, as such a lot of config values have been moved there.
Our exhaustion patch has been trimmed and only a few values for exhaustion remain in paper.yml, the others now sit in spigot.yml
2014-08-17 16:47:36 -05:00

38 lines
1.8 KiB
Diff

From 9ca6ab77b96d4f00ed0f5361bbf0a92957de9722 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
index 79d4d99..2c3a140 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1396,8 +1396,14 @@ public final class CraftServer implements Server {
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));
--
1.9.1