papermc/CraftBukkit-Patches/0126-Address-Serious-Issues-with-Offline-Players.patch

40 lines
1.8 KiB
Diff

From 39524f0f91c9945265786856e1f6935a110cd601 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Sat, 12 Apr 2014 17:17:10 +1000
Subject: [PATCH] Address Serious Issues with Offline Players
Such as name being entirely unresolved! This fixes the whitelist command and no doubt lots more.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
index bd98822..7af54cf 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
@@ -48,6 +48,12 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
if (player != null) {
return player.getName();
}
+ // Spigot Start
+ if ( profile != null )
+ {
+ return profile.getName();
+ }
+ // Spigot End
// This might not match lastKnownName but if not it should be more correct
if (profile.getName() != null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 4920956..c30197b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1330,7 +1330,7 @@ public final class CraftServer implements Server {
if (result == null) {
result = offlinePlayers.get(id);
if (result == null) {
- result = new CraftOfflinePlayer(this, new GameProfile(id, null));
+ result = new CraftOfflinePlayer(this, MinecraftServer.getServer().getUserCache().a(id)); // Spigot - this is blocking, but we have no choice!
offlinePlayers.put(id, result);
}
} else {
--
1.8.3.2