mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-17 21:33:49 -07:00
Fixed EntityDamageByEntityEvent to call for every attackable entity. Fixes BUKKIT-1129, Fixes BUKKIT-1054 and Fixes BUKKIT-147.
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.entity.EntityTargetEvent; // CraftBukkit
|
||||
|
||||
public abstract class EntityMonster extends EntityCreature implements IMonster {
|
||||
|
||||
@@ -82,24 +77,6 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
|
||||
i -= 2 << this.getEffect(MobEffectList.WEAKNESS).getAmplifier();
|
||||
}
|
||||
|
||||
// CraftBukkit start - this is still duplicated here and EntityHuman because it's possible for lastDamage EntityMonster
|
||||
// to damage another EntityMonster, and we want to catch those events.
|
||||
// This does not fire events for slime attacks, av they're not lastDamage EntityMonster.
|
||||
if (entity instanceof EntityLiving && !(entity instanceof EntityHuman)) {
|
||||
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
|
||||
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(this.getBukkitEntity(), damagee, EntityDamageEvent.DamageCause.ENTITY_ATTACK, this.damage);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
i = event.getDamage();
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
return entity.damageEntity(DamageSource.mobAttack(this), i);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
return entity.damageEntity(DamageSource.mobAttack(this), i);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user