From 669a822bd6c7fa996384c9d5eed2970bad5da74d Mon Sep 17 00:00:00 2001 From: Lixfel Date: Mon, 22 Jun 2020 17:14:45 +0200 Subject: [PATCH] Hotfix WaterRemover loop Signed-off-by: Lixfel --- .../de/steamwar/fightsystem/utils/WaterRemover.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/utils/WaterRemover.java b/FightSystem_Main/src/de/steamwar/fightsystem/utils/WaterRemover.java index 64ef49e..b4cb48b 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++; } }