diff options
author | VictorD <victor.danell@gmail.com> | 2011-01-24 23:24:17 +0100 |
---|---|---|
committer | VictorD <victor.danell@gmail.com> | 2011-01-24 23:24:17 +0100 |
commit | 152daf40ac81e279d62879a6aa425d0836c219b4 (patch) | |
tree | 551160ed7b5dc7d51b572394a6dedbdcf039682e | |
parent | 1c999edda4f6a7fc3ab308718b124b45e2acf183 (diff) | |
download | bukkit-152daf40ac81e279d62879a6aa425d0836c219b4.tar bukkit-152daf40ac81e279d62879a6aa425d0836c219b4.tar.gz bukkit-152daf40ac81e279d62879a6aa425d0836c219b4.tar.lz bukkit-152daf40ac81e279d62879a6aa425d0836c219b4.tar.xz bukkit-152daf40ac81e279d62879a6aa425d0836c219b4.zip |
Added getBlockReplacedState to enable checking of type of replaced block.
-rw-r--r-- | src/main/java/org/bukkit/event/block/BlockPlaceEvent.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java b/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java index 3c9489e2..c84b9c6e 100644 --- a/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java +++ b/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java @@ -1,9 +1,10 @@ package org.bukkit.event.block; import org.bukkit.block.Block; -import org.bukkit.inventory.ItemStack; +import org.bukkit.block.BlockState; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; +import org.bukkit.inventory.ItemStack; /** * Not implemented yet @@ -12,14 +13,16 @@ public class BlockPlaceEvent extends BlockEvent implements Cancellable { protected boolean cancel; protected boolean canBuild; protected Block placedAgainst; + protected BlockState replacedBlockState; protected ItemStack itemInHand; protected Player player; - public BlockPlaceEvent(Type type, Block placedBlock, Block placedAgainst, ItemStack itemInHand, Player thePlayer, boolean canBuild) { + public BlockPlaceEvent(Type type, Block placedBlock, BlockState replacedBlockState, Block placedAgainst, ItemStack itemInHand, Player thePlayer, boolean canBuild) { super(type, placedBlock); this.placedAgainst = placedAgainst; this.itemInHand = itemInHand; this.player = thePlayer; + this.replacedBlockState = replacedBlockState; this.canBuild = canBuild; cancel = false; } @@ -63,6 +66,15 @@ public class BlockPlaceEvent extends BlockEvent implements Cancellable { return getBlock(); } + /** + * Returns the state of the block which was replaced. Material type air mostly. + * + * @return BlockState of block which was replaced. + */ + public BlockState getBlockReplacedState() { + return this.replacedBlockState; + } + /** * Get the block that this block was placed against |