summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorEvilSeph <evilseph@gmail.com>2012-10-31 13:53:33 -0400
committerEvilSeph <evilseph@gmail.com>2012-10-31 14:24:03 -0400
commit1623bf0f9be5502a40d5c01f6704af9e96660eda (patch)
treee15af9a3a72888114fe2d8d54221068daa45c78a /src/main/java
parent87a1cd3d43c1a86c51abcde72f778636e979e0ee (diff)
downloadcraftbukkit-1623bf0f9be5502a40d5c01f6704af9e96660eda.tar
craftbukkit-1623bf0f9be5502a40d5c01f6704af9e96660eda.tar.gz
craftbukkit-1623bf0f9be5502a40d5c01f6704af9e96660eda.tar.lz
craftbukkit-1623bf0f9be5502a40d5c01f6704af9e96660eda.tar.xz
craftbukkit-1623bf0f9be5502a40d5c01f6704af9e96660eda.zip
Fire HangingBreakEvent when explosions remove hanging entities. Fixes BUKKIT-2764
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/net/minecraft/server/EntityHanging.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main/java/net/minecraft/server/EntityHanging.java b/src/main/java/net/minecraft/server/EntityHanging.java
index 0db41ca1..e40857e4 100644
--- a/src/main/java/net/minecraft/server/EntityHanging.java
+++ b/src/main/java/net/minecraft/server/EntityHanging.java
@@ -206,7 +206,7 @@ public abstract class EntityHanging extends Entity {
public boolean damageEntity(DamageSource damagesource, int i) {
if (!this.dead && !this.world.isStatic) {
// CraftBukkit start
- HangingBreakEvent event = null;
+ HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.DEFAULT);
PaintingBreakEvent paintingEvent = null;
if (damagesource.getEntity() != null) {
event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity());
@@ -215,18 +215,18 @@ public abstract class EntityHanging extends Entity {
// Fire old painting event until it can be removed
paintingEvent = new org.bukkit.event.painting.PaintingBreakByEntityEvent((Painting) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity());
}
+ } else if (damagesource == DamageSource.EXPLOSION || damagesource == DamageSource.EXPLOSION2) {
+ event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.EXPLOSION);
}
- if (event != null) {
- this.world.getServer().getPluginManager().callEvent(event);
- }
+ this.world.getServer().getPluginManager().callEvent(event);
if (paintingEvent != null) {
- paintingEvent.setCancelled(event != null && event.isCancelled());
+ paintingEvent.setCancelled(event.isCancelled());
this.world.getServer().getPluginManager().callEvent(paintingEvent);
}
- if (dead || (event != null && event.isCancelled()) || (paintingEvent != null && paintingEvent.isCancelled())) {
+ if (dead || event.isCancelled() || (paintingEvent != null && paintingEvent.isCancelled())) {
return true;
}
// CraftBukkit end