SPIGOT-7302: Fix more issues with EntityDamageByEntity
- Fix Projectile damage by dispenser - Fix cases where only exists a direct entity damager
This commit is contained in:
parent
48394703de
commit
58504fa61b
@ -878,12 +878,15 @@ public class CraftEventFactory {
|
|||||||
entity.lastDamageCancelled = true; // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Keep track if the event was canceled
|
entity.lastDamageCancelled = true; // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Keep track if the event was canceled
|
||||||
}
|
}
|
||||||
return event;
|
return event;
|
||||||
} else if (source.getEntity() != null) {
|
} else if (source.getEntity() != null || source.getDirectEntity() != null) {
|
||||||
Entity damager = source.getEntity();
|
Entity damager = source.getEntity();
|
||||||
DamageCause cause = (source.isSweep()) ? DamageCause.ENTITY_SWEEP_ATTACK : DamageCause.ENTITY_ATTACK;
|
DamageCause cause = (source.isSweep()) ? DamageCause.ENTITY_SWEEP_ATTACK : DamageCause.ENTITY_ATTACK;
|
||||||
|
|
||||||
if (source.isIndirect() && source.getDirectEntity() != null) {
|
if (source.isIndirect() && source.getDirectEntity() != null) {
|
||||||
damager = source.getDirectEntity();
|
damager = source.getDirectEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (damager instanceof IProjectile) {
|
||||||
if (damager.getBukkitEntity() instanceof ThrownPotion) {
|
if (damager.getBukkitEntity() instanceof ThrownPotion) {
|
||||||
cause = DamageCause.MAGIC;
|
cause = DamageCause.MAGIC;
|
||||||
} else if (damager.getBukkitEntity() instanceof Projectile) {
|
} else if (damager.getBukkitEntity() instanceof Projectile) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user