Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
BlockGrowEvent.java
1 package org.bukkit.event.block;
2 
3 import org.bukkit.block.Block;
7 
8 /**
9  * Called when a block grows naturally in the world.
10  * <p>
11  * Examples:
12  * <ul>
13  * <li>Wheat
14  * <li>Sugar Cane
15  * <li>Cactus
16  * <li>Watermelon
17  * <li>Pumpkin
18  * </ul>
19  * <p>
20  * If a Block Grow event is cancelled, the block will not grow.
21  */
22 public class BlockGrowEvent extends BlockEvent implements Cancellable {
23  private static final HandlerList handlers = new HandlerList();
24  private final BlockState newState;
25  private boolean cancelled = false;
26 
27  public BlockGrowEvent(final Block block, final BlockState newState) {
28  super(block);
29  this.newState = newState;
30  }
31 
32  /**
33  * Gets the state of the block where it will form or spread to.
34  *
35  * @return The block state for this events block
36  */
38  return newState;
39  }
40 
41  public boolean isCancelled() {
42  return cancelled;
43  }
44 
45  public void setCancelled(boolean cancel) {
46  this.cancelled = cancel;
47  }
48 
49  public HandlerList getHandlers() {
50  return handlers;
51  }
52 
53  public static HandlerList getHandlerList() {
54  return handlers;
55  }
56 }