summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGJ <gjmcferrin@gmail.com>2014-01-24 08:55:26 -0800
committerTravis Watkins <amaranth@ubuntu.com>2014-04-18 08:45:35 -0500
commiteb43d0637cf9e35042aafcfa21232b01527652c1 (patch)
tree231f4339ff47b758c1cb7a5772d92782b1795f67 /src
parenta81f26716d47643af0f7b090be6b739599312eea (diff)
downloadcraftbukkit-eb43d0637cf9e35042aafcfa21232b01527652c1.tar
craftbukkit-eb43d0637cf9e35042aafcfa21232b01527652c1.tar.gz
craftbukkit-eb43d0637cf9e35042aafcfa21232b01527652c1.tar.lz
craftbukkit-eb43d0637cf9e35042aafcfa21232b01527652c1.tar.xz
craftbukkit-eb43d0637cf9e35042aafcfa21232b01527652c1.zip
[Bleeding] Add missing HangingBreakEvent. Fixes BUKKIT-3943
The old PaintingBreakByEntityEvent was deprecated and replaced by HangingBreakByEntityEvent. However, in the case of being struck by lightning, only the deprecated event was being called. This fixes that so that both the new and old events are called appropriately.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/net/minecraft/server/Entity.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 9d933cba..1d0dee0b 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -11,10 +11,12 @@ import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.TravelAgent;
import org.bukkit.block.BlockFace;
+import org.bukkit.entity.Hanging;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Painting;
import org.bukkit.entity.Vehicle;
import org.bukkit.event.entity.EntityCombustByEntityEvent;
+import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.painting.PaintingBreakByEntityEvent;
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
import org.bukkit.event.vehicle.VehicleEnterEvent;
@@ -1588,11 +1590,22 @@ public abstract class Entity {
final org.bukkit.entity.Entity stormBukkitEntity = entitylightning.getBukkitEntity();
final PluginManager pluginManager = Bukkit.getPluginManager();
- if (thisBukkitEntity instanceof Painting) {
- PaintingBreakByEntityEvent event = new PaintingBreakByEntityEvent((Painting) thisBukkitEntity, stormBukkitEntity);
- pluginManager.callEvent(event);
+ if (thisBukkitEntity instanceof Hanging) {
+ HangingBreakByEntityEvent hangingEvent = new HangingBreakByEntityEvent((Hanging) thisBukkitEntity, stormBukkitEntity);
+ PaintingBreakByEntityEvent paintingEvent = null;
- if (event.isCancelled()) {
+ if (thisBukkitEntity instanceof Painting) {
+ paintingEvent = new PaintingBreakByEntityEvent((Painting) thisBukkitEntity, stormBukkitEntity);
+ }
+
+ pluginManager.callEvent(hangingEvent);
+
+ if (paintingEvent != null) {
+ paintingEvent.setCancelled(hangingEvent.isCancelled());
+ pluginManager.callEvent(paintingEvent);
+ }
+
+ if (hangingEvent.isCancelled() || (paintingEvent != null && paintingEvent.isCancelled())) {
return;
}
}