From c452c1a375945bef37879039e2ac1baf358a3505 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Wed, 2 Nov 2016 22:45:14 +0100 Subject: [PATCH] Fixed NPE --- src/main/java/buttondevteam/lib/TBMCPlayer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/buttondevteam/lib/TBMCPlayer.java b/src/main/java/buttondevteam/lib/TBMCPlayer.java index 7267799..bdb02c5 100644 --- a/src/main/java/buttondevteam/lib/TBMCPlayer.java +++ b/src/main/java/buttondevteam/lib/TBMCPlayer.java @@ -9,6 +9,8 @@ import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; + import com.palmergames.bukkit.towny.Towny; import com.palmergames.bukkit.towny.object.Resident; import com.palmergames.bukkit.towny.object.TownyUniverse; @@ -438,7 +440,8 @@ public class TBMCPlayer implements AutoCloseable { */ @Override public void close() { - if (!Bukkit.getPlayer(uuid).isOnline()) + final Player player = Bukkit.getPlayer(uuid); + if (player == null || !player.isOnline()) getLoadedPlayers().remove(uuid); }