Package org.bukkit.event.block
Class BlockCanBuildEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.block.BlockEvent
org.bukkit.event.block.BlockCanBuildEvent
Called when we try to place a block, to see if we can build it here or not.
 
Note:
- The Block returned by getBlock() is the block we are trying to place on, not the block we are trying to place.
- If you want to figure out what is being placed, use getMaterial()instead.
- 
Nested Class SummaryNested classes/interfaces inherited from class org.bukkit.event.EventEvent.Result
- 
Field SummaryFieldsFields inherited from class org.bukkit.event.block.BlockEventblock
- 
Constructor SummaryConstructorsConstructorDescriptionBlockCanBuildEvent(Block block, BlockData type, boolean canBuild) Deprecated.BlockCanBuildEvent(Block block, Player player, BlockData type, boolean canBuild) 
- 
Method SummaryModifier and TypeMethodDescriptionGets the BlockData that we are trying to place.static HandlerListGets the Material that we are trying to place.Gets the player who placed the block involved in this event.booleanGets whether or not the block can be built here.voidsetBuildable(boolean cancel) Sets whether the block can be built here or not.Methods inherited from class org.bukkit.event.block.BlockEventgetBlockMethods inherited from class org.bukkit.event.EventgetEventName, isAsynchronous
- 
Field Details- 
buildableprotected boolean buildable
- 
blockData
 
- 
- 
Constructor Details- 
BlockCanBuildEvent@Deprecated public BlockCanBuildEvent(@NotNull Block block, @NotNull BlockData type, boolean canBuild) Deprecated.
- 
BlockCanBuildEventpublic BlockCanBuildEvent(@NotNull Block block, @Nullable Player player, @NotNull BlockData type, boolean canBuild) - Parameters:
- block- the block involved in this event
- player- the player placing the block
- type- the id of the block to place
- canBuild- whether we can build
 
 
- 
- 
Method Details- 
isBuildablepublic boolean isBuildable()Gets whether or not the block can be built here.By default, returns Minecraft's answer on whether the block can be built here or not. - Returns:
- boolean whether or not the block can be built
 
- 
setBuildablepublic void setBuildable(boolean cancel) Sets whether the block can be built here or not.- Parameters:
- cancel- true if you want to allow the block to be built here despite Minecraft's default behaviour
 
- 
getMaterialGets the Material that we are trying to place.- Returns:
- The Material that we are trying to place
 
- 
getBlockDataGets the BlockData that we are trying to place.- Returns:
- The BlockData that we are trying to place
 
- 
getPlayerGets the player who placed the block involved in this event.
 May be null for legacy calls of the event.- Returns:
- The Player who placed the block involved in this event
 
- 
getHandlers- Specified by:
- getHandlersin class- Event
 
- 
getHandlerList
 
-