summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/bukkit/event/block/BlockFadeEvent.java
blob: ac937656f8995109403a55c6ae69df138f5cd551 (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
49
50
51
52
53
54
55
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 fades, melts or disappears based on world conditions
 * <p />
 * Examples:
 * <ul>
 * <li>Snow melting due to being near a light source.</li>
 * <li>Ice melting due to being near a light source.</li>
 * </ul>
 * <p />
 * If a Block Fade event is cancelled, the block will not fade, melt or disappear.
 */
@SuppressWarnings("serial")
public class BlockFadeEvent extends BlockEvent implements Cancellable {
    private static final HandlerList handlers = new HandlerList();
    private boolean cancelled;
    private BlockState newState;

    public BlockFadeEvent(Block block, BlockState newState) {
        super(Type.BLOCK_FADE, block);
        this.newState = newState;
        this.cancelled = false;
    }

    /**
     * Gets the state of the block that will be fading, melting or disappearing.
     *
     * @return The block state of the block that will be fading, melting or disappearing
     */
    public BlockState getNewState() {
        return newState;
    }

    public boolean isCancelled() {
        return cancelled;
    }

    public void setCancelled(boolean cancel) {
        this.cancelled = cancel;
    }

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

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