From fabb5e628a795db269cb5ec5d4b6b89e9ce0d9c8 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Thu, 30 Dec 2010 22:07:37 +0000 Subject: [PATCH] BlockPhysics can be canceled By: Dinnerbone --- .../bukkit/event/block/BlockPhysicsEvent.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/paper-api/src/org/bukkit/event/block/BlockPhysicsEvent.java b/paper-api/src/org/bukkit/event/block/BlockPhysicsEvent.java index 845491f26d..77cdece0fb 100644 --- a/paper-api/src/org/bukkit/event/block/BlockPhysicsEvent.java +++ b/paper-api/src/org/bukkit/event/block/BlockPhysicsEvent.java @@ -11,6 +11,7 @@ import org.bukkit.event.Event; public class BlockPhysicsEvent extends BlockEvent { private final Block block; private final int changed; + private boolean cancel = false; public BlockPhysicsEvent(final Event.Type type, final Block block, final int changed) { super(type); @@ -44,4 +45,24 @@ public class BlockPhysicsEvent extends BlockEvent { public ItemStack.Type getChangedType() { return ItemStack.Type.getType(changed); // TODO: Move type to its own file } + + /** + * Gets the cancellation state of this event. A cancelled event will not + * be executed in the server, but will still pass to other plugins + * + * @return true if this event is cancelled + */ + public boolean isCancelled() { + return cancel; + } + + /** + * Sets the cancellation state of this event. A cancelled event will not + * be executed in the server, but will still pass to other plugins + * + * @param cancel true if you wish to cancel this event + */ + public void setCancelled(boolean cancel) { + this.cancel = cancel; + } }