Use fetched GameProfile for getOfflinePlayer(String)

When getting an OfflinePlayer by name we lookup their UUID and then
use that to fetch the OfflinePlayer. If the player has not played on
this server before the resulting OfflinePlayer will return null for
getName(). As this is unintuitive we now create the OfflinePlayer directly
using the profile we looked up and make OfflinePlayer prefer that data.

By: Travis Watkins <amaranth@ubuntu.com>
This commit is contained in:
CraftBukkit/Spigot
2014-04-12 02:38:53 -05:00
parent d24dac2c06
commit 8553d1d462
2 changed files with 19 additions and 6 deletions

View File

@@ -49,6 +49,11 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
return player.getName();
}
// This might not match lastKnownName but if not it should be more correct
if (profile.getName() != null) {
return profile.getName();
}
NBTTagCompound data = getBukkitData();
if (data != null) {