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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int damage = 0;
|
||||||
|
|
||||||
if (entity instanceof Player) {
|
if (entity instanceof Player) {
|
||||||
|
damage = 1;
|
||||||
Player player = (Player) entity;
|
Player player = (Player) entity;
|
||||||
|
|
||||||
if (!player.isOnline()) {
|
if (!player.isOnline()) {
|
||||||
@ -35,21 +38,30 @@ public class BleedTimer implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Never kill with Bleeding
|
// Never kill with Bleeding
|
||||||
if (player.getHealth() - 1 > 0) {
|
if (player.getHealth() - damage > 0) {
|
||||||
CombatTools.dealDamage(player, 1);
|
CombatTools.dealDamage(player, damage);
|
||||||
ParticleEffectUtils.playBleedEffect(entity);
|
ParticleEffectUtils.playBleedEffect(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
entry.setValue(entry.getValue() - 1);
|
entry.setValue(entry.getValue() - damage);
|
||||||
|
|
||||||
if (entry.getValue() <= 0) {
|
if (entry.getValue() <= 0) {
|
||||||
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding.Stopped"));
|
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding.Stopped"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CombatTools.dealDamage(entity, 2);
|
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);
|
ParticleEffectUtils.playBleedEffect(entity);
|
||||||
entry.setValue(entry.getValue() - 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user