Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 55 lines 1.5 kB view raw
1package org.bukkit.event.block; 2 3import org.bukkit.block.Block; 4import org.bukkit.block.BlockState; 5import org.bukkit.event.Cancellable; 6 7/** 8 * Called when a block is formed or spreads based on world conditions. 9 * Use {@link BlockSpreadEvent} to catch blocks that actually spread and don't just "randomly" form. 10 * <p/> 11 * Examples: 12 * <ul> 13 * <li>Snow forming due to a snow storm.</li> 14 * <li>Ice forming in a snowy Biome like Tiga or Tundra.</li> 15 * </ul> 16 * <p/> 17 * If a Block Form event is cancelled, the block will not be formed. 18 * 19 * @see BlockSpreadEvent 20 */ 21public class BlockFormEvent extends BlockEvent implements Cancellable { 22 private boolean cancelled; 23 private BlockState newState; 24 25 public BlockFormEvent(Block block, BlockState newState) { 26 super(Type.BLOCK_FORM, block); 27 this.block = block; 28 this.newState = newState; 29 this.cancelled = false; 30 } 31 32 public BlockFormEvent(Type type, Block block, BlockState newState) { 33 super(type, block); 34 this.block = block; 35 this.newState = newState; 36 this.cancelled = false; 37 } 38 39 /** 40 * Gets the state of the block where it will form or spread to. 41 * 42 * @return The block state of the block where it will form or spread to 43 */ 44 public BlockState getNewState() { 45 return newState; 46 } 47 48 public boolean isCancelled() { 49 return cancelled; 50 } 51 52 public void setCancelled(boolean cancel) { 53 this.cancelled = cancel; 54 } 55}