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.
This commit is contained in:
Travis Watkins
2014-04-12 02:38:53 -05:00
parent 8f771c7378
commit 7b409ed4e9
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) {