PaperSpigot-Parent/CraftBukkit-Patches/0125-Address-Serious-Issues-with-Offline-Players.patch

41 lines
1.8 KiB
Diff
Raw Normal View History

2014-04-12 10:17:59 +02:00
From 5662e336a6db545f6d610d85c3940d64e8385c70 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
2014-04-12 10:17:59 +02:00
index d92f503..5cae703 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
2014-04-12 10:17:59 +02:00
// 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
2014-04-12 10:17:59 +02:00
index 4920956..c30197b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2014-04-12 10:17:59 +02:00
@@ -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