diff --git a/paper-api/src/org/bukkit/event/block/BlockListener.java b/paper-api/src/org/bukkit/event/block/BlockListener.java index 722edb6097..c54b677cd1 100644 --- a/paper-api/src/org/bukkit/event/block/BlockListener.java +++ b/paper-api/src/org/bukkit/event/block/BlockListener.java @@ -3,12 +3,15 @@ package org.bukkit.event.block; import org.bukkit.event.Listener; /** - * Handles all events thrown in relation to a Block + * Handles all events thrown in relation to Blocks * * @author durron597 */ public class BlockListener implements Listener { - public BlockListener() { + /** + * Default Constructor + */ + public BlockListener() { } /** @@ -66,6 +69,6 @@ public class BlockListener implements Listener { * * @param event Relevant event details */ - public void onRedstoneChange(BlockFromToEvent event) { + public void onRedstoneChange(BlockFromToEvent event) { } } diff --git a/paper-api/src/org/bukkit/event/block/BlockPhysicsEvent.java b/paper-api/src/org/bukkit/event/block/BlockPhysicsEvent.java index cb44ef31cd..d42f2151a8 100644 --- a/paper-api/src/org/bukkit/event/block/BlockPhysicsEvent.java +++ b/paper-api/src/org/bukkit/event/block/BlockPhysicsEvent.java @@ -1,23 +1,58 @@ -/** - * - */ -package org.bukkit.event.block; - -import org.bukkit.Block; - -/** - * @author jmartin - * - */ -public class BlockPhysicsEvent extends BlockEvent { - - /** - * @param type - * @param theBlock - */ - public BlockPhysicsEvent(Type type, Block theBlock) { - super(type, theBlock); - // TODO Auto-generated constructor stub - } - -} +package org.bukkit.event.block; + +import org.bukkit.Block; +import org.bukkit.ItemStack; +import org.bukkit.event.Event; + +/** + * Thrown when a block physics check is called + * + * @author Dinnerbone + */ +public class BlockPhysicsEvent extends BlockEvent { + private final int changed; + private boolean cancel = false; + + public BlockPhysicsEvent(final Event.Type type, final Block block, final int changed) { + super(type, block); + this.changed = changed; + } + + /** + * Gets the type of block that changed, causing this event + * + * @return Changed block's type ID + */ + public int getChangedTypeID() { + return changed; + } + + /** + * Gets the type of block that changed, causing this event + * + * @return Changed block's type + */ + 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; + } +}