mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-23 00:15:05 +00:00
use a damage event only for setting last damage cause (#649)
Firing this tricks other plugins into believing this entity was damaged. In addition, Entity#damage also fires a damage event, so no need to fire a duplicate one.
This commit is contained in:
parent
cbb3581a12
commit
3613ca6577
1 changed files with 3 additions and 7 deletions
|
@ -58,12 +58,8 @@ public class DamageHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityDamageByEntityEvent finalEvent = new EntityDamageByEntityEvent(source, entity, cause, damage);
|
EntityDamageByEntityEvent finalEvent = new EntityDamageByEntityEvent(source, entity, cause, damage);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(finalEvent);
|
((LivingEntity) entity).damage(damage, source);
|
||||||
if (!finalEvent.isCancelled()) {
|
entity.setLastDamageCause(finalEvent);
|
||||||
damage = finalEvent.getDamage();
|
|
||||||
((LivingEntity) entity).damage(damage, source);
|
|
||||||
entity.setLastDamageCause(finalEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Bukkit.getPluginManager().isPluginEnabled("NoCheatPlus") && source != null) {
|
if (Bukkit.getPluginManager().isPluginEnabled("NoCheatPlus") && source != null) {
|
||||||
NCPExemptionManager.unexempt(source);
|
NCPExemptionManager.unexempt(source);
|
||||||
|
|
Loading…
Reference in a new issue