diff options
author | t00thpick1 <t00thpick1dirko@gmail.com> | 2013-12-09 23:03:57 -0500 |
---|---|---|
committer | Nate Mortensen <nate.richard.mortensen@gmail.com> | 2013-12-13 20:05:35 -0700 |
commit | c2a0396af25caf14a3e499e6fb3e0077b60149a4 (patch) | |
tree | 4ffad0e5a1b2072066d005c4a430678da8f543c0 /src/main | |
parent | e6bccf6bfdbd59deb11734433cc85349c01b1e20 (diff) | |
download | craftbukkit-c2a0396af25caf14a3e499e6fb3e0077b60149a4.tar craftbukkit-c2a0396af25caf14a3e499e6fb3e0077b60149a4.tar.gz craftbukkit-c2a0396af25caf14a3e499e6fb3e0077b60149a4.tar.lz craftbukkit-c2a0396af25caf14a3e499e6fb3e0077b60149a4.tar.xz craftbukkit-c2a0396af25caf14a3e499e6fb3e0077b60149a4.zip |
Throw event when EnderCrystals harm EnderDragon. Fixes BUKKIT-4052
The EntityLiving dealDamage method will not call an event for the
entity damage caused by an explosion without an associated
entity cause, therefore, the explosion caused by EnderCrystals
needs to be explicitely handled within the EnderDragon class.
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityEnderDragon.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java index 7067a64a..6cb09c43 100644 --- a/src/main/java/net/minecraft/server/EntityEnderDragon.java +++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java @@ -7,6 +7,7 @@ import java.util.List; import org.bukkit.block.BlockState; import org.bukkit.craftbukkit.util.BlockStateListPopulator; import org.bukkit.event.entity.EntityCreatePortalEvent; +import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.Bukkit; @@ -300,7 +301,15 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo if (this.bC != null) { if (this.bC.dead) { if (!this.world.isStatic) { - this.a(this.bq, DamageSource.explosion((Explosion) null), 10.0F); + // CraftBukkit start + EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), org.bukkit.event.entity.EntityDamageEvent.DamageCause.ENTITY_EXPLOSION, 10.0F); + Bukkit.getPluginManager().callEvent(event); + + if (!event.isCancelled()) { + getBukkitEntity().setLastDamageCause(event); + this.a(this.bq, DamageSource.explosion((Explosion) null), (float) event.getDamage()); + } + // CraftBukkit end } this.bC = null; |