Added handling of null PlayerName (#11)
This commit is contained in:
parent
0f7e08b304
commit
3c3652653e
1 changed files with 4 additions and 1 deletions
|
@ -92,7 +92,10 @@ public class TBMCPlayer {
|
||||||
player.UUID = p.getUniqueId();
|
player.UUID = p.getUniqueId();
|
||||||
player.PlayerName = yc.getString("playername");
|
player.PlayerName = yc.getString("playername");
|
||||||
System.out.println("Player name: " + player.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());
|
System.out.println("Renaming " + player.PlayerName + " to " + p.getName());
|
||||||
TownyUniverse tu = Towny.getPlugin(Towny.class).getTownyUniverse();
|
TownyUniverse tu = Towny.getPlugin(Towny.class).getTownyUniverse();
|
||||||
Resident resident = tu.getResidentMap().get(player.PlayerName);
|
Resident resident = tu.getResidentMap().get(player.PlayerName);
|
||||||
|
|
Loading…
Reference in a new issue