summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java')
-rw-r--r--src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java b/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java
new file mode 100644
index 00000000..9853164f
--- /dev/null
+++ b/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java
@@ -0,0 +1,47 @@
+/**
+ *
+ */
+package org.bukkit.event.block;
+
+import org.bukkit.Block;
+import org.bukkit.Material;
+import org.bukkit.event.Cancellable;
+
+/**
+ * @author durron597
+ */
+public class BlockCanBuildEvent extends BlockEvent {
+ protected boolean buildable;
+ protected int material;
+
+ public BlockCanBuildEvent(Type type, Block block, int id, boolean canBuild) {
+ super(type, 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;
+ }
+}