summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/bukkit/event/block/BlockSpreadEvent.java
blob: e90a2b81e467b7e23a521cae1ba25e15aa4e7664 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package org.bukkit.event.block;

import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.event.HandlerList;

/**
 * Called when a block spreads based on world conditions.
 * Use {@link BlockFormEvent} to catch blocks that "randomly" form instead of actually spread.
 * <p />
 * Examples:
 * <ul>
 * <li>Mushrooms spreading.</li>
 * <li>Fire spreading.</li>
 * </ul>
 * <p />
 * If a Block Spread event is cancelled, the block will not spread.
 *
 * @see BlockFormEvent
 */
@SuppressWarnings("serial")
public class BlockSpreadEvent extends BlockFormEvent {
    private static final HandlerList handlers = new HandlerList();
    private Block source;

    public BlockSpreadEvent(Block block, Block source, BlockState newState) {
        super(Type.BLOCK_SPREAD, block, newState);
        this.source = source;
    }

    /**
     * Gets the source block involved in this event.
     *
     * @return the Block for the source block involved in this event.
     */
    public Block getSource() {
        return source;
    }

    @Override
    public HandlerList getHandlers() {
        return handlers;
    }

    public static HandlerList getHandlerList() {
        return handlers;
    }
}