mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Do not allow additions of timer tasks while iterating
Follow up on:
e4d980b135
Should help debug #4019 (and let us know when this actually occurs)
This commit is contained in:
parent
4246f59d44
commit
bb7989449e
@ -22,9 +22,11 @@ import java.util.Map.Entry;
|
||||
|
||||
public class BleedTimerTask extends BukkitRunnable {
|
||||
private static Map<LivingEntity, BleedContainer> bleedList = new HashMap<LivingEntity, BleedContainer>();
|
||||
private static boolean isIterating = false;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
isIterating = true;
|
||||
Iterator<Entry<LivingEntity, BleedContainer>> bleedIterator = bleedList.entrySet().iterator();
|
||||
|
||||
while (bleedIterator.hasNext()) {
|
||||
@ -136,6 +138,7 @@ public class BleedTimerTask extends BukkitRunnable {
|
||||
|
||||
// Bukkit.broadcastMessage(debugMessage);
|
||||
}
|
||||
isIterating = false;
|
||||
}
|
||||
|
||||
public static BleedContainer copyContainer(BleedContainer container)
|
||||
@ -176,6 +179,8 @@ public class BleedTimerTask extends BukkitRunnable {
|
||||
throw new IllegalStateException("Cannot add bleed task async!");
|
||||
}
|
||||
|
||||
if (isIterating) throw new IllegalStateException("Cannot add task while iterating timers!");
|
||||
|
||||
if(toolTier < 4)
|
||||
ticks = Math.max(1, (ticks / 3));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user