diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/utils/WaterRemover.java b/FightSystem_Main/src/de/steamwar/fightsystem/utils/WaterRemover.java index 64ef49e..63119f3 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/utils/WaterRemover.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/utils/WaterRemover.java @@ -16,11 +16,19 @@ public class WaterRemover { private static final Map explodedBlocks = Collections.synchronizedMap(new HashMap<>()); private static Set waterList = new HashSet<>(); + private static boolean isRunning = false; + private static int steps = 1; public static void init() { Bukkit.getScheduler().runTaskTimerAsynchronously(FightSystem.getPlugin(), () -> { + if(isRunning){ + steps++; + return; + } + isRunning = true; wateredCheck(); removeWater(); + isRunning = false; }, 0, 20); } @@ -41,13 +49,14 @@ public class WaterRemover { it.remove(); continue; } - e.setValue(e.getValue() + 1); + e.setValue(e.getValue() + steps); if(e.getValue() > 15) it.remove(); } + steps = 1; }catch(ConcurrentModificationException e){ - wateredCheck(); + steps++; } } @@ -73,7 +82,7 @@ public class WaterRemover { private static void collectBlocks(Block anchor, Set collected, Set visitedBlocks) { if( !isWater(anchor) || - visitedBlocks.contains(anchor) + visitedBlocks.contains(anchor) ) return;