Debounce entity break block events.

This commit is contained in:
sk89q 2014-08-24 12:36:17 -07:00
parent 9282fc25de
commit 7c7673af20

View File

@ -113,6 +113,7 @@ public class EventAbstractionListener extends AbstractListener {
private final BlockEntityEventDebounce interactDebounce = new BlockEntityEventDebounce(10000); private final BlockEntityEventDebounce interactDebounce = new BlockEntityEventDebounce(10000);
private final EntityEntityEventDebounce pickupDebounce = new EntityEntityEventDebounce(10000); private final EntityEntityEventDebounce pickupDebounce = new EntityEntityEventDebounce(10000);
private final BlockEntityEventDebounce entityBreakBlockDebounce = new BlockEntityEventDebounce(10000);
/** /**
* Construct the listener. * Construct the listener.
@ -202,7 +203,8 @@ public void onEntityChangeBlock(EntityChangeBlockEvent event) {
// Switch around the event // Switch around the event
Events.fireToCancel(event, new SpawnEntityEvent(event, create(block), entity)); Events.fireToCancel(event, new SpawnEntityEvent(event, create(block), entity));
} else { } else {
Events.fireToCancel(event, new BreakBlockEvent(event, create(entity), event.getBlock())); entityBreakBlockDebounce.debounce(
event.getBlock(), event.getEntity(), event, new BreakBlockEvent(event, create(entity), event.getBlock()));
} }
} else { } else {
boolean wasCancelled = event.isCancelled(); boolean wasCancelled = event.isCancelled();