Added handling of null PlayerName (#11)

This commit is contained in:
Norbi Peti 2016-10-12 21:22:21 +02:00
parent 0f7e08b304
commit 3c3652653e

View file

@ -92,7 +92,10 @@ public class TBMCPlayer {
player.UUID = p.getUniqueId();
player.PlayerName = yc.getString("playername");
System.out.println("Player name: " + player.PlayerName);
if (!p.getName().equals(player.PlayerName)) {
if (player.PlayerName == null) {
player.PlayerName = p.getName();
System.out.println("Player name saved: " + player.PlayerName);
} else if (!p.getName().equals(player.PlayerName)) {
System.out.println("Renaming " + player.PlayerName + " to " + p.getName());
TownyUniverse tu = Towny.getPlugin(Towny.class).getTownyUniverse();
Resident resident = tu.getResidentMap().get(player.PlayerName);