From e9187ad9fafe716787d8cdf6d49844afe2b1b83e Mon Sep 17 00:00:00 2001 From: Zrips Date: Sat, 4 Feb 2017 18:30:13 +0200 Subject: [PATCH] Clone map to avoid issues --- .classpath | 1 + com/gamingmesh/jobs/Jobs.java | 4 +- com/gamingmesh/jobs/economy/.gitignore | 1 + com/gamingmesh/jobs/economy/VaultEconomy.java | 86 +++++++++---------- 4 files changed, 48 insertions(+), 44 deletions(-) diff --git a/.classpath b/.classpath index a41020a9..69397823 100644 --- a/.classpath +++ b/.classpath @@ -9,5 +9,6 @@ + diff --git a/com/gamingmesh/jobs/Jobs.java b/com/gamingmesh/jobs/Jobs.java index 6a54e3bb..5c90350c 100644 --- a/com/gamingmesh/jobs/Jobs.java +++ b/com/gamingmesh/jobs/Jobs.java @@ -472,7 +472,9 @@ public class Jobs extends JavaPlugin { int y = 0; int total = Jobs.getPlayerManager().getMapSize(); long time = System.currentTimeMillis(); - Iterator> it = Jobs.getPlayerManager().getPlayersInfoUUIDMap().entrySet().iterator(); + // Cloning to avoid issues + HashMap temp = new HashMap(Jobs.getPlayerManager().getPlayersInfoUUIDMap()); + Iterator> it = temp.entrySet().iterator(); while (it.hasNext()) { Entry one = it.next(); if (!running) diff --git a/com/gamingmesh/jobs/economy/.gitignore b/com/gamingmesh/jobs/economy/.gitignore index e462dc0d..df73fb25 100644 --- a/com/gamingmesh/jobs/economy/.gitignore +++ b/com/gamingmesh/jobs/economy/.gitignore @@ -8,3 +8,4 @@ /IConomy6Adapter.class /IConomy7Adapter.class /IConomyAdapter.class +/CraftConomy3Adapter.class diff --git a/com/gamingmesh/jobs/economy/VaultEconomy.java b/com/gamingmesh/jobs/economy/VaultEconomy.java index 88896894..2445593c 100644 --- a/com/gamingmesh/jobs/economy/VaultEconomy.java +++ b/com/gamingmesh/jobs/economy/VaultEconomy.java @@ -21,50 +21,50 @@ package com.gamingmesh.jobs.economy; import org.bukkit.OfflinePlayer; public class VaultEconomy implements Economy { - private net.milkbowl.vault.economy.Economy vault; + private net.milkbowl.vault.economy.Economy vault; - public VaultEconomy(net.milkbowl.vault.economy.Economy vault) { - this.vault = vault; - } + public VaultEconomy(net.milkbowl.vault.economy.Economy vault) { + this.vault = vault; + } - @Override - public boolean depositPlayer(OfflinePlayer offlinePlayer, double money) { - return vault.depositPlayer(offlinePlayer, money).transactionSuccess(); - } - - @SuppressWarnings("deprecation") - @Override - public boolean depositPlayer(String PlayerName, double money) { - return vault.depositPlayer(PlayerName, money).transactionSuccess(); - } - - @Override - public boolean withdrawPlayer(OfflinePlayer offlinePlayer, double money) { - return vault.withdrawPlayer(offlinePlayer, money).transactionSuccess(); - } + @Override + public boolean depositPlayer(OfflinePlayer offlinePlayer, double money) { + return vault.depositPlayer(offlinePlayer, money).transactionSuccess(); + } + + @SuppressWarnings("deprecation") + @Override + public boolean depositPlayer(String PlayerName, double money) { + return vault.depositPlayer(PlayerName, money).transactionSuccess(); + } + + @Override + public boolean withdrawPlayer(OfflinePlayer offlinePlayer, double money) { + return vault.withdrawPlayer(offlinePlayer, money).transactionSuccess(); + } + + @SuppressWarnings("deprecation") + @Override + public boolean withdrawPlayer(String PlayerName, double money) { + return vault.withdrawPlayer(PlayerName, money).transactionSuccess(); + } + + @Override + public boolean hasMoney(OfflinePlayer offlinePlayer, double money) { + if (offlinePlayer.getName() == null) + return false; + return vault.has(offlinePlayer, money); + } + + @SuppressWarnings("deprecation") + @Override + public boolean hasMoney(String PlayerName, double money) { + return vault.has(PlayerName, money); + } + + @Override + public String format(double money) { + return vault.format(money); + } - @SuppressWarnings("deprecation") - @Override - public boolean withdrawPlayer(String PlayerName, double money) { - return vault.withdrawPlayer(PlayerName, money).transactionSuccess(); - } - - @Override - public boolean hasMoney(OfflinePlayer offlinePlayer, double money) { - if (offlinePlayer.getName() == null) - return false; - return vault.has(offlinePlayer, money); - } - - @SuppressWarnings("deprecation") - @Override - public boolean hasMoney(String PlayerName, double money) { - return vault.has(PlayerName, money); - } - - @Override - public String format(double money) { - return vault.format(money); - } - }