Added LocalPlayer.getBlockInHand().

Also added an appropriate overload to BukkitPlayer.
This commit is contained in:
TomyLobo
2013-11-10 13:53:17 +01:00
parent cd0bc62931
commit 1a96847f88
4 changed files with 67 additions and 0 deletions

View File

@@ -456,6 +456,19 @@ public abstract class LocalPlayer {
*/
public abstract int getItemInHand();
/**
* Get the Block that the player is holding.
*
* @return the item id of the item the player is holding
*/
public BaseBlock getBlockInHand() throws WorldEditException {
final int typeId = getItemInHand();
if (!getWorld().isValidBlockType(typeId)) {
throw new NotABlockException(typeId);
}
return new BaseBlock(typeId);
}
/**
* Get the name of the player.
*