1
0
mirror of https://github.com/mcMMO-Dev/mcMMO.git synced 2026-02-21 11:13:00 +01:00

Move bleeding to mcBleedTimer

Put all the logic handling adding/removing/contains there and encapsulate our List
Additionally, should prevent a ConcurrentModificationException by locking, but I'm not 100% on the contiains not throing such an exception.
This commit is contained in:
NuclearW
2012-03-18 16:59:35 -04:00
parent b10f599a87
commit 8f2c424657
9 changed files with 182 additions and 84 deletions

View File

@@ -291,29 +291,4 @@ public class m {
return skillLevel;
}
}
/**
* Simulate a bleed.
*
* @param plugin mcMMO plugin instance
*/
public static void bleedSimulate(mcMMO plugin) {
/* Set up the tracker */
plugin.misc.bleedTracker.addAll(plugin.misc.bleedQue);
plugin.misc.bleedQue.clear();
plugin.misc.bleedTracker.removeAll(plugin.misc.bleedRemovalQue);
plugin.misc.bleedRemovalQue.clear();
/* Bleed monsters/animals */
for (LivingEntity entity : plugin.misc.bleedTracker) {
if ((entity == null || entity.isDead())) {
plugin.misc.bleedRemovalQue.add(entity);
continue;
}
else {
Combat.dealDamage(entity, 2);
}
}
}
}