summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java
blob: bb2e0e59735f76151f0408b1d397aa91a9af361f (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
/**
 *
 */
package org.bukkit.event.block;

import org.bukkit.block.Block;
import org.bukkit.Material;

/**
 * @author durron597
 */
public class BlockCanBuildEvent extends BlockEvent {
    protected boolean buildable;
    protected int material;

    public BlockCanBuildEvent(Block block, int id, boolean canBuild) {
        super(Type.BLOCK_CANBUILD, block);
        buildable = canBuild;
        material = id;
    }

    /**
     * Returns whether or not the block can be built here. By default, returns
     * Minecraft's answer on whether the block can be built
     *
     * @return boolean whether or not the block can be built
     */
    public boolean isBuildable() {
        return buildable;
    }

    /**
     * Set whether the block can be built here.
     */
    public void setBuildable(boolean cancel) {
        this.buildable = cancel;
    }

    public Material getMaterial() {
        return Material.getMaterial(material);
    }

    public int getMaterialId() {
        return material;
    }
}