From 3c3652653e5866dcfe967020086140c11c15b581 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Wed, 12 Oct 2016 21:22:21 +0200 Subject: [PATCH] Added handling of null PlayerName (#11) --- src/main/java/buttondevteam/bucket/core/TBMCPlayer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/buttondevteam/bucket/core/TBMCPlayer.java b/src/main/java/buttondevteam/bucket/core/TBMCPlayer.java index 4ee3001..a5e7c74 100644 --- a/src/main/java/buttondevteam/bucket/core/TBMCPlayer.java +++ b/src/main/java/buttondevteam/bucket/core/TBMCPlayer.java @@ -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);