SteamWar/FightSystem
Archiviert
13
1

Hotfix WaterRemover loop

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2020-06-22 17:16:54 +02:00
Ursprung 51fe8cfbe5
Commit 87f13942b1

Datei anzeigen

@ -16,11 +16,19 @@ public class WaterRemover {
private static final Map<Location, Integer> explodedBlocks = Collections.synchronizedMap(new HashMap<>()); private static final Map<Location, Integer> explodedBlocks = Collections.synchronizedMap(new HashMap<>());
private static Set<Block> waterList = new HashSet<>(); private static Set<Block> waterList = new HashSet<>();
private static boolean isRunning = false;
private static int steps = 1;
public static void init() { public static void init() {
Bukkit.getScheduler().runTaskTimerAsynchronously(FightSystem.getPlugin(), () -> { Bukkit.getScheduler().runTaskTimerAsynchronously(FightSystem.getPlugin(), () -> {
if(isRunning){
steps++;
return;
}
isRunning = true;
wateredCheck(); wateredCheck();
removeWater(); removeWater();
isRunning = false;
}, 0, 20); }, 0, 20);
} }
@ -41,13 +49,14 @@ public class WaterRemover {
it.remove(); it.remove();
continue; continue;
} }
e.setValue(e.getValue() + 1); e.setValue(e.getValue() + steps);
if(e.getValue() > 15) if(e.getValue() > 15)
it.remove(); it.remove();
} }
steps = 1;
}catch(ConcurrentModificationException e){ }catch(ConcurrentModificationException e){
wateredCheck(); steps++;
} }
} }