Raise SpawnEntityEvent for BlockExpEvent.

This commit is contained in:
sk89q 2014-08-18 18:56:07 -07:00
parent 937a5758f7
commit bb64079d17

View File

@ -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
//-------------------------------------------------------------------------