3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 20:40:08 +01:00

Register damage caused by PrimedTNT entities as BLOCK_EXPLOSION

This fixes BUKKIT-74
Dieser Commit ist enthalten in:
Andrew Ardill 2011-12-02 16:55:23 +11:00
Ursprung 9fe5529791
Commit 8511ef3902

Datei anzeigen

@ -7,6 +7,7 @@ import java.util.Random;
import java.util.Set;
// CraftBukkit start
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.entity.EntityDamageByBlockEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
@ -135,7 +136,14 @@ public class Explosion {
entity.motZ += d2 * d10;
}
} else {
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(this.source.getBukkitEntity(), damagee, EntityDamageEvent.DamageCause.ENTITY_EXPLOSION, damageDone);
final org.bukkit.entity.Entity damager = this.source.getBukkitEntity();
final EntityDamageEvent.DamageCause damageCause;
if (damager instanceof TNTPrimed) {
damageCause = EntityDamageEvent.DamageCause.BLOCK_EXPLOSION;
} else {
damageCause = EntityDamageEvent.DamageCause.ENTITY_EXPLOSION;
}
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageCause, damageDone);
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {