Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.event.block.BlockPlaceEvent Class Reference
Inheritance diagram for org.bukkit.event.block.BlockPlaceEvent:
org.bukkit.event.block.BlockEvent org.bukkit.event.Cancellable org.bukkit.event.Event org.bukkit.event.block.BlockMultiPlaceEvent

Public Member Functions

 BlockPlaceEvent (final Block placedBlock, final BlockState replacedBlockState, final Block placedAgainst, final ItemStack itemInHand, final Player thePlayer, final boolean canBuild)
 
boolean isCancelled ()
 
void setCancelled (boolean cancel)
 
Player getPlayer ()
 
Block getBlockPlaced ()
 
BlockState getBlockReplacedState ()
 
Block getBlockAgainst ()
 
ItemStack getItemInHand ()
 
boolean canBuild ()
 
void setBuild (boolean canBuild)
 
HandlerList getHandlers ()
 
- Public Member Functions inherited from org.bukkit.event.block.BlockEvent
 BlockEvent (final Block theBlock)
 
final Block getBlock ()
 
- Public Member Functions inherited from org.bukkit.event.Event
 Event ()
 
 Event (boolean isAsync)
 
String getEventName ()
 
abstract HandlerList getHandlers ()
 
final boolean isAsynchronous ()
 

Static Public Member Functions

static HandlerList getHandlerList ()
 

Protected Attributes

boolean cancel
 
boolean canBuild
 
Block placedAgainst
 
BlockState replacedBlockState
 
ItemStack itemInHand
 
Player player
 
- Protected Attributes inherited from org.bukkit.event.block.BlockEvent
Block block
 

Detailed Description

Called when a block is placed by a player.

If a Block Place event is cancelled, the block will not be placed.

Definition at line 15 of file BlockPlaceEvent.java.

Member Function Documentation

boolean org.bukkit.event.block.BlockPlaceEvent.canBuild ( )

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.

Returns
boolean whether the server would allow a player to build here

Definition at line 99 of file BlockPlaceEvent.java.

Referenced by org.bukkit.event.block.BlockPlaceEvent.setBuild().

99  {
100  return this.canBuild;
101  }
Block org.bukkit.event.block.BlockPlaceEvent.getBlockAgainst ( )

Gets the block that this block was placed against

Returns
Block the block that the new block was placed against

Definition at line 76 of file BlockPlaceEvent.java.

76  {
77  return placedAgainst;
78  }
Block org.bukkit.event.block.BlockPlaceEvent.getBlockPlaced ( )

Clarity method for getting the placed block. Not really needed except for reasons of clarity.

Returns
The Block that was placed

Definition at line 57 of file BlockPlaceEvent.java.

References org.bukkit.event.block.BlockEvent.getBlock().

57  {
58  return getBlock();
59  }
BlockState org.bukkit.event.block.BlockPlaceEvent.getBlockReplacedState ( )

Gets the BlockState for the block which was replaced. Material type air mostly.

Returns
The BlockState for the block which was replaced.

Definition at line 67 of file BlockPlaceEvent.java.

67  {
68  return this.replacedBlockState;
69  }
ItemStack org.bukkit.event.block.BlockPlaceEvent.getItemInHand ( )

Gets the item in the player's hand when they placed the block.

Returns
The ItemStack for the item in the player's hand when they placed the block

Definition at line 86 of file BlockPlaceEvent.java.

86  {
87  return itemInHand;
88  }
Player org.bukkit.event.block.BlockPlaceEvent.getPlayer ( )

Gets the player who placed the block involved in this event.

Returns
The Player who placed the block involved in this event

Definition at line 47 of file BlockPlaceEvent.java.

47  {
48  return player;
49  }
boolean org.bukkit.event.block.BlockPlaceEvent.isCancelled ( )

Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins

Returns
true if this event is cancelled

Implements org.bukkit.event.Cancellable.

Definition at line 34 of file BlockPlaceEvent.java.

34  {
35  return cancel;
36  }
void org.bukkit.event.block.BlockPlaceEvent.setBuild ( boolean  canBuild)

Sets the canBuild state of this event. Set to true if you want the player to be able to build.

Parameters
canBuildtrue if you want the player to be able to build

Definition at line 109 of file BlockPlaceEvent.java.

References org.bukkit.event.block.BlockPlaceEvent.canBuild().

109  {
110  this.canBuild = canBuild;
111  }
void org.bukkit.event.block.BlockPlaceEvent.setCancelled ( boolean  cancel)

Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.

Parameters
canceltrue if you wish to cancel this event

Implements org.bukkit.event.Cancellable.

Definition at line 38 of file BlockPlaceEvent.java.

38  {
39  this.cancel = cancel;
40  }

The documentation for this class was generated from the following file: