mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-25 09:41:29 +01:00
[Bleeding] Fixed potions throwing double events. Fixes BUKKIT-1332
By: feildmaster <admin@feildmaster.com>
This commit is contained in:
parent
c925bcb49d
commit
ae4b2591f7
@ -364,14 +364,17 @@ public class CraftEventFactory {
|
||||
|
||||
public static EntityDamageEvent handleEntityDamageEvent(Entity entity, DamageSource source, int damage) {
|
||||
Entity damager = source.getEntity();
|
||||
EntityDamageEvent.DamageCause cause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
DamageCause cause = DamageCause.ENTITY_ATTACK;
|
||||
|
||||
if (source instanceof EntityDamageSourceIndirect) {
|
||||
damager = ((EntityDamageSourceIndirect) source).getProximateDamageSource();
|
||||
if (damager.getBukkitEntity() instanceof Projectile) {
|
||||
cause = EntityDamageEvent.DamageCause.PROJECTILE;
|
||||
} // Else, magic..?
|
||||
if (damager.getBukkitEntity() instanceof ThrownPotion) {
|
||||
cause = DamageCause.MAGIC;
|
||||
} else if (damager.getBukkitEntity() instanceof Projectile) {
|
||||
cause = DamageCause.PROJECTILE;
|
||||
}
|
||||
}
|
||||
|
||||
return callEntityDamageEvent(damager, entity, cause, damage);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user