From 152daf40ac81e279d62879a6aa425d0836c219b4 Mon Sep 17 00:00:00 2001 From: VictorD Date: Mon, 24 Jan 2011 23:24:17 +0100 Subject: Added getBlockReplacedState to enable checking of type of replaced block. --- .../java/org/bukkit/event/block/BlockPlaceEvent.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src') 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 -- cgit v1.2.3