mirror of
https://github.com/PaperMC/Paper.git
synced 2026-11-25 10:29:41 -05: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 parent
c625d00351
commit
4503167283
11 files changed
+72
-185
No files matched your search
@@ -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