From 0b12aebfe2f6c6b99c6980029fbf8144766f6472 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sun, 30 Oct 2016 00:23:16 +0200 Subject: [PATCH] Fixed NPE on player data access --- src/main/java/buttondevteam/lib/TBMCPlayer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/buttondevteam/lib/TBMCPlayer.java b/src/main/java/buttondevteam/lib/TBMCPlayer.java index 65fe19d..f2c2c06 100644 --- a/src/main/java/buttondevteam/lib/TBMCPlayer.java +++ b/src/main/java/buttondevteam/lib/TBMCPlayer.java @@ -251,6 +251,7 @@ public class TBMCPlayer implements AutoCloseable { TBMCPlayer player = new TBMCPlayer(); player.uuid = p.getUniqueId(); player.data.putAll(yc.getValues(true)); + LoadedPlayers.put(p.getUniqueId(), player); // Accessing any value requires it to be in the map Bukkit.getLogger().info("Loaded player: " + player.getPlayerName()); if (player.getPlayerName() == null) { player.setPlayerName(p.getName()); @@ -268,7 +269,6 @@ public class TBMCPlayer implements AutoCloseable { player.setPlayerName(p.getName()); Bukkit.getLogger().info("Renaming done."); } - LoadedPlayers.put(p.getUniqueId(), player); // Load in other plugins Bukkit.getServer().getPluginManager().callEvent(new TBMCPlayerLoadEvent(yc, player)); @@ -282,8 +282,8 @@ public class TBMCPlayer implements AutoCloseable { public static TBMCPlayer addPlayer(OfflinePlayer p) { TBMCPlayer player = new TBMCPlayer(); player.uuid = p.getUniqueId(); + LoadedPlayers.put(p.getUniqueId(), player); // Accessing any value requires it to be in the map player.setPlayerName(p.getName()); - LoadedPlayers.put(p.getUniqueId(), player); Bukkit.getServer().getPluginManager().callEvent(new TBMCPlayerAddEvent(player)); savePlayer(player); return player;