summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Ardill <andrew.ardill@gmail.com>2011-12-02 16:55:23 +1100
committerAndrew Ardill <andrew.ardill@gmail.com>2011-12-02 16:55:23 +1100
commit8511ef3902131bfd395297d61db44698679cb4e1 (patch)
tree7b3e98881a6d79e35b30c1ab4dd292df51052428 /src
parent9fe552979160e7f6b0e5210896474c8f0cbc0703 (diff)
downloadcraftbukkit-8511ef3902131bfd395297d61db44698679cb4e1.tar
craftbukkit-8511ef3902131bfd395297d61db44698679cb4e1.tar.gz
craftbukkit-8511ef3902131bfd395297d61db44698679cb4e1.tar.lz
craftbukkit-8511ef3902131bfd395297d61db44698679cb4e1.tar.xz
craftbukkit-8511ef3902131bfd395297d61db44698679cb4e1.zip
Register damage caused by PrimedTNT entities as BLOCK_EXPLOSION
This fixes BUKKIT-74
Diffstat (limited to 'src')
-rw-r--r--src/main/java/net/minecraft/server/Explosion.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index 491f9375..1d67dccf 100644
--- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -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()) {