Package org.bukkit.event.block
Class BlockCanBuildEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.block.BlockEvent
org.bukkit.event.block.BlockCanBuildEvent
public class BlockCanBuildEvent extends BlockEvent
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()orgetMaterialId()instead.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
Constructors Constructor Description BlockCanBuildEvent(Block block, int id, boolean canBuild)Deprecated.Magic value -
Method Summary
Modifier and Type Method Description static HandlerListgetHandlerList()HandlerListgetHandlers()MaterialgetMaterial()Gets the Material that we are trying to place.intgetMaterialId()Deprecated.Magic valuebooleanisBuildable()Gets whether or not the block can be built here.voidsetBuildable(boolean cancel)Sets whether the block can be built here or not.
-
Field Details
-
Constructor Details
-
BlockCanBuildEvent
Deprecated.Magic value- Parameters:
block- the block involved in this eventid- the id of the block to placecanBuild- whether we can build
-
-
Method Details
-
isBuildable
public 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
-
setBuildable
public 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
-
getMaterial
Gets the Material that we are trying to place.- Returns:
- The Material that we are trying to place
-
getMaterialId
@Deprecated public int getMaterialId()Deprecated.Magic valueGets the Material ID for the Material that we are trying to place.- Returns:
- The Material ID for the Material that we are trying to place
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getHandlerList
-