001 package org.bukkit.event.block;
002
003 import org.bukkit.block.Block;
004 import org.bukkit.block.BlockState;
005 import org.bukkit.event.HandlerList;
006
007 /**
008 * Called when a block spreads based on world conditions.
009 * <p>
010 * Use {@link BlockFormEvent} to catch blocks that "randomly" form instead of
011 * actually spread.
012 * <p>
013 * Examples:
014 * <ul>
015 * <li>Mushrooms spreading.
016 * <li>Fire spreading.
017 * </ul>
018 * <p>
019 * If a Block Spread event is cancelled, the block will not spread.
020 *
021 * @see BlockFormEvent
022 */
023 public class BlockSpreadEvent extends BlockFormEvent {
024 private static final HandlerList handlers = new HandlerList();
025 private final Block source;
026
027 public BlockSpreadEvent(final Block block, final Block source, final BlockState newState) {
028 super(block, newState);
029 this.source = source;
030 }
031
032 /**
033 * Gets the source block involved in this event.
034 *
035 * @return the Block for the source block involved in this event.
036 */
037 public Block getSource() {
038 return source;
039 }
040
041 @Override
042 public HandlerList getHandlers() {
043 return handlers;
044 }
045
046 public static HandlerList getHandlerList() {
047 return handlers;
048 }
049 }