mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Fixed CME in BleedTimer
This commit is contained in:
parent
0bdd5b219f
commit
356c97cd67
@ -27,7 +27,10 @@ public class BleedTimer implements Runnable {
|
||||
continue;
|
||||
}
|
||||
|
||||
int damage = 0;
|
||||
|
||||
if (entity instanceof Player) {
|
||||
damage = 1;
|
||||
Player player = (Player) entity;
|
||||
|
||||
if (!player.isOnline()) {
|
||||
@ -35,22 +38,31 @@ public class BleedTimer implements Runnable {
|
||||
}
|
||||
|
||||
// Never kill with Bleeding
|
||||
if (player.getHealth() - 1 > 0) {
|
||||
CombatTools.dealDamage(player, 1);
|
||||
if (player.getHealth() - damage > 0) {
|
||||
CombatTools.dealDamage(player, damage);
|
||||
ParticleEffectUtils.playBleedEffect(entity);
|
||||
}
|
||||
|
||||
entry.setValue(entry.getValue() - 1);
|
||||
entry.setValue(entry.getValue() - damage);
|
||||
|
||||
if (entry.getValue() <= 0) {
|
||||
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding.Stopped"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
CombatTools.dealDamage(entity, 2);
|
||||
ParticleEffectUtils.playBleedEffect(entity);
|
||||
damage = 2;
|
||||
|
||||
// Anticipate the entity's death to prevent CME because of our EntityDeathEvent listener
|
||||
if (entity.getHealth() - damage > 0) {
|
||||
entry.setValue(entry.getValue() - 1);
|
||||
}
|
||||
else {
|
||||
bleedIterator.remove();
|
||||
}
|
||||
|
||||
CombatTools.dealDamage(entity, damage);
|
||||
ParticleEffectUtils.playBleedEffect(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user