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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user