diff --git a/src/com/projectkorra/projectkorra/util/RevertChecker.java b/src/com/projectkorra/projectkorra/util/RevertChecker.java index f4028e6f..7956a62d 100644 --- a/src/com/projectkorra/projectkorra/util/RevertChecker.java +++ b/src/com/projectkorra/projectkorra/util/RevertChecker.java @@ -12,9 +12,10 @@ import org.bukkit.entity.Player; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import java.util.concurrent.Callable; -import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Future; public class RevertChecker implements Runnable { @@ -23,11 +24,10 @@ public class RevertChecker implements Runnable { private static final FileConfiguration config = ConfigManager.defaultConfig.get(); private static final boolean safeRevert = config.getBoolean("Properties.Earth.SafeRevert"); - public static ConcurrentHashMap earthRevertQueue = new ConcurrentHashMap(); - static ConcurrentHashMap airRevertQueue = new ConcurrentHashMap(); - static ConcurrentHashMap chunks = new ConcurrentHashMap(); - // static ConcurrentHashMap movedEarthQueue = new - // ConcurrentHashMap(); + public static Set earthRevertQueue = new HashSet<>(); + static Set airRevertQueue = new HashSet<>(); + //static ConcurrentHashMap chunks = new ConcurrentHashMap(); + // static ConcurrentHashMap movedEarthQueue = new ConcurrentHashMap(); private long time; @@ -36,14 +36,14 @@ public class RevertChecker implements Runnable { } public static void revertAirBlocks() { - for (int ID : airRevertQueue.keySet()) { + for (int ID : airRevertQueue) { EarthMethods.revertAirBlock(ID); RevertChecker.airRevertQueue.remove(ID); } } public static void revertEarthBlocks() { - for (Block block : earthRevertQueue.keySet()) { + for (Block block : earthRevertQueue) { EarthMethods.revertBlock(block); earthRevertQueue.remove(block); } @@ -58,14 +58,14 @@ public class RevertChecker implements Runnable { // } private void addToAirRevertQueue(int i) { - if (!airRevertQueue.containsKey(i)) - airRevertQueue.put(i, i); + if (!airRevertQueue.contains(i)) + airRevertQueue.add(i); } private void addToRevertQueue(Block block) { - if (!earthRevertQueue.containsKey(block)) - earthRevertQueue.put(block, block); + if (!earthRevertQueue.contains(block)) + earthRevertQueue.add(block); } public void run() { @@ -81,7 +81,7 @@ public class RevertChecker implements Runnable { earth.putAll(EarthMethods.movedearth); for (Block block : earth.keySet()) { - if (earthRevertQueue.containsKey(block)) + if (earthRevertQueue.contains(block)) continue; boolean remove = true; Information info = earth.get(block); @@ -97,7 +97,7 @@ public class RevertChecker implements Runnable { air.putAll(EarthMethods.tempair); for (Integer i : air.keySet()) { - if (airRevertQueue.containsKey(i)) + if (airRevertQueue.contains(i)) continue; boolean remove = true; Information info = air.get(i);