summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authordurron597 <martin.jared@gmail.com>2011-01-07 05:38:45 -0500
committerdurron597 <martin.jared@gmail.com>2011-01-07 05:38:45 -0500
commit5d2a8ae74c73970bb94682d39d8dad8161657bfa (patch)
tree397cb0176a275a401138e3392748da57ae787c20 /src
parent3fc85a5e829d685044c6c8fb8e886b409dd60400 (diff)
downloadbukkit-5d2a8ae74c73970bb94682d39d8dad8161657bfa.tar
bukkit-5d2a8ae74c73970bb94682d39d8dad8161657bfa.tar.gz
bukkit-5d2a8ae74c73970bb94682d39d8dad8161657bfa.tar.lz
bukkit-5d2a8ae74c73970bb94682d39d8dad8161657bfa.tar.xz
bukkit-5d2a8ae74c73970bb94682d39d8dad8161657bfa.zip
Added canBuild to event
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/event/player/PlayerBlockItemEvent.java42
1 files changed, 24 insertions, 18 deletions
diff --git a/src/main/java/org/bukkit/event/player/PlayerBlockItemEvent.java b/src/main/java/org/bukkit/event/player/PlayerBlockItemEvent.java
index 2af86624..766296e3 100644
--- a/src/main/java/org/bukkit/event/player/PlayerBlockItemEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerBlockItemEvent.java
@@ -24,27 +24,12 @@ import org.bukkit.event.Cancellable;
public class PlayerBlockItemEvent extends PlayerItemEvent implements Cancellable {
protected Block blockClicked;
protected BlockFace direction;
- protected boolean cancel;
+ protected boolean canBuild;
- public PlayerBlockItemEvent(Type type, Player who, ItemStack item, Block blockClicked, BlockFace direction) {
+ public PlayerBlockItemEvent(Type type, Player who, ItemStack item, Block blockClicked, BlockFace direction, boolean canBuild) {
super(type, who, item);
this.blockClicked = blockClicked;
- cancel = false;
- }
-
- /**
- * Gets the cancellation state of this event. Set to true if you
- * want to prevent buckets from placing water, from a block from being
- * placed
- *
- * @return boolean cancellation state
- */
- public boolean isCancelled() {
- return cancel;
- }
-
- public void setCancelled(boolean cancel) {
- this.cancel = cancel;
+ this.canBuild = canBuild;
}
/**
@@ -76,4 +61,25 @@ public class PlayerBlockItemEvent extends PlayerItemEvent implements Cancellable
public BlockFace getBlockFace() {
return direction;
}
+
+ /**
+ * Gets the value whether the player would be allowed to build here.
+ * Defaults to spawn if the server was going to stop them (such as, the
+ * player is in Spawn). Note that this is an entirely different check
+ * than BLOCK_CANBUILD, as this refers to a player, not universe-physics
+ * rule like cactus on dirt.
+ *
+ * @return boolean whether the server would allow a player to build here
+ */
+ public boolean canBuild() {
+ return this.canBuild;
+ }
+
+ /**
+ * Sets the canBuild state of this event. Set to true if you want the
+ * player to be able to build.
+ */
+ public void setBuild(boolean canBuild) {
+ this.canBuild = canBuild;
+ }
}