mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 09:47:40 +01:00
SPIGOT-7302: Fix more issues with EntityDamageByEntity
- Fix Projectile damage by dispenser - Fix cases where only exists a direct entity damager By: Doc <nachito94@msn.com>
This commit is contained in:
parent
609c06878c
commit
5a539a8bf5
@ -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…
Reference in New Issue
Block a user