diff options
author | Feildmaster <admin@feildmaster.com> | 2012-02-11 23:09:10 -0600 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-02-22 21:46:15 -0500 |
commit | 4475ea7718d29d0fb69c3bf955ad5c16b8c1e324 (patch) | |
tree | d1518690ebb5a82d77d5db2bd7295acf3a4baf22 /src/main/java/org | |
parent | e0eb9f914b135cd0ed0bbe0f21c8b62d2aa7a4e4 (diff) | |
download | bukkit-4475ea7718d29d0fb69c3bf955ad5c16b8c1e324.tar bukkit-4475ea7718d29d0fb69c3bf955ad5c16b8c1e324.tar.gz bukkit-4475ea7718d29d0fb69c3bf955ad5c16b8c1e324.tar.lz bukkit-4475ea7718d29d0fb69c3bf955ad5c16b8c1e324.tar.xz bukkit-4475ea7718d29d0fb69c3bf955ad5c16b8c1e324.zip |
[Bleeding] Added BlockGrowEvent. Addresses BUKKIT-104
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/bukkit/event/block/BlockFormEvent.java | 26 | ||||
-rw-r--r-- | src/main/java/org/bukkit/event/block/BlockGrowEvent.java | 56 |
2 files changed, 58 insertions, 24 deletions
diff --git a/src/main/java/org/bukkit/event/block/BlockFormEvent.java b/src/main/java/org/bukkit/event/block/BlockFormEvent.java index 7e65e502..84835d28 100644 --- a/src/main/java/org/bukkit/event/block/BlockFormEvent.java +++ b/src/main/java/org/bukkit/event/block/BlockFormEvent.java @@ -19,33 +19,11 @@ import org.bukkit.event.HandlerList; * * @see BlockSpreadEvent */ -public class BlockFormEvent extends BlockEvent implements Cancellable { +public class BlockFormEvent extends BlockGrowEvent implements Cancellable { private static final HandlerList handlers = new HandlerList(); - private boolean cancelled; - private final BlockState newState; public BlockFormEvent(final Block block, final BlockState newState) { - super(block); - this.block = block; - this.newState = newState; - this.cancelled = false; - } - - /** - * Gets the state of the block where it will form or spread to. - * - * @return The block state of the block where it will form or spread to - */ - public BlockState getNewState() { - return newState; - } - - public boolean isCancelled() { - return cancelled; - } - - public void setCancelled(boolean cancel) { - this.cancelled = cancel; + super(block, newState); } @Override diff --git a/src/main/java/org/bukkit/event/block/BlockGrowEvent.java b/src/main/java/org/bukkit/event/block/BlockGrowEvent.java new file mode 100644 index 00000000..b1216df4 --- /dev/null +++ b/src/main/java/org/bukkit/event/block/BlockGrowEvent.java @@ -0,0 +1,56 @@ +package org.bukkit.event.block; + +import org.bukkit.block.Block; +import org.bukkit.block.BlockState; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; + +/** + * Called when a block grows naturally in the world. + * <p /> + * Examples: + * <ul> + * <li>Wheat</li> + * <li>Sugar Cane</li> + * <li>Cactus</li> + * <li>Watermelon</li> + * <li>Pumpkin</li> + * </ul> + * <p /> + * If a Block Grow event is cancelled, the block will not grow. + */ +public class BlockGrowEvent extends BlockEvent implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private final BlockState newState; + private boolean cancelled = false; + + public BlockGrowEvent(final Block block, final BlockState newState) { + super(block); + this.newState = newState; + } + + /** + * Gets the state of the block where it will form or spread to. + * + * @return The block state for this events block + */ + public BlockState getNewState() { + return newState; + } + + public boolean isCancelled() { + return cancelled; + } + + public void setCancelled(boolean cancel) { + this.cancelled = cancel; + } + + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } +} |