From f73ac5d5ba1c4d8117e557c5c0e4c04f5b4ccf52 Mon Sep 17 00:00:00 2001 From: Fabrizio La Rosa Date: Thu, 18 Jun 2020 03:56:52 +0200 Subject: [PATCH] Fixed possible NullPointer on bank save --- src/main/java/com/songoda/skyblock/bank/BankManager.java | 6 +++++- .../java/com/songoda/skyblock/playerdata/PlayerData.java | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/songoda/skyblock/bank/BankManager.java b/src/main/java/com/songoda/skyblock/bank/BankManager.java index 4e829937..78073003 100644 --- a/src/main/java/com/songoda/skyblock/bank/BankManager.java +++ b/src/main/java/com/songoda/skyblock/bank/BankManager.java @@ -80,6 +80,10 @@ public class BankManager { } public List getTransactionList(Player player) { - return log.get(player.getUniqueId()); + return getTransactionList(player.getUniqueId()); + } + + public List getTransactionList(UUID uuid) { + return log.get(uuid); } } diff --git a/src/main/java/com/songoda/skyblock/playerdata/PlayerData.java b/src/main/java/com/songoda/skyblock/playerdata/PlayerData.java index d3401ac8..ed2d2a3c 100644 --- a/src/main/java/com/songoda/skyblock/playerdata/PlayerData.java +++ b/src/main/java/com/songoda/skyblock/playerdata/PlayerData.java @@ -255,7 +255,7 @@ public class PlayerData { } public void save() { - transactions = BankManager.getInstance().getTransactionList(getPlayer()); + transactions = BankManager.getInstance().getTransactionList(getPlayerUUID()); Config config = getConfig(); FileConfiguration configLoad = config.getFileConfiguration(); configLoad.set("Statistics.Island.Playtime", getPlaytime()); @@ -287,6 +287,10 @@ public class PlayerData { return Bukkit.getPlayer(uuid); } + public UUID getPlayerUUID() { + return uuid; + } + public List getTransactions() { return transactions; }