From bb64079d17ab0c6fcdce4cf3c9187750e9447e4b Mon Sep 17 00:00:00 2001 From: sk89q Date: Mon, 18 Aug 2014 18:56:07 -0700 Subject: [PATCH] Raise SpawnEntityEvent for BlockExpEvent. --- .../bukkit/listener/EventAbstractionListener.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java b/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java index 79a34b1c..03229407 100644 --- a/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java +++ b/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java @@ -56,6 +56,7 @@ import org.bukkit.event.block.BlockBurnEvent; import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.block.BlockDispenseEvent; +import org.bukkit.event.block.BlockExpEvent; import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; @@ -410,6 +411,13 @@ public void onVehicleDestroy(VehicleDestroyEvent event) { Events.fireToCancel(event, new DestroyEntityEvent(event, create(event.getAttacker()), event.getVehicle())); } + @EventHandler + public void onBlockExp(BlockExpEvent event) { + if (Events.fireAndTestCancel(new SpawnEntityEvent(event, create(event.getBlock()), event.getBlock().getLocation(), EntityType.EXPERIENCE_ORB))) { + event.setExpToDrop(0); + } + } + // TODO: XP pickup is an entity destroy event //-------------------------------------------------------------------------