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()
instead.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
-
Field Summary
Fields Modifier and Type Field Description protected BlockData
blockData
protected boolean
buildable
-
Fields inherited from class org.bukkit.event.block.BlockEvent
block
-
-
Constructor Summary
Constructors Constructor Description BlockCanBuildEvent(Block block, BlockData type, boolean canBuild)
Deprecated.BlockCanBuildEvent(Block block, Player player, BlockData type, boolean canBuild)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BlockData
getBlockData()
Gets the BlockData that we are trying to place.static HandlerList
getHandlerList()
HandlerList
getHandlers()
Material
getMaterial()
Gets the Material that we are trying to place.Player
getPlayer()
Gets the player who placed the block involved in this event.boolean
isBuildable()
Gets whether or not the block can be built here.void
setBuildable(boolean cancel)
Sets whether the block can be built here or not.-
Methods inherited from class org.bukkit.event.block.BlockEvent
getBlock
-
Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
-
-
-
Field Detail
-
buildable
protected boolean buildable
-
blockData
protected BlockData blockData
-
-
Constructor Detail
-
BlockCanBuildEvent
@Deprecated public BlockCanBuildEvent(@NotNull Block block, @NotNull BlockData type, boolean canBuild)
Deprecated.
-
-
Method Detail
-
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
@NotNull public Material getMaterial()
Gets the Material that we are trying to place.- Returns:
- The Material that we are trying to place
-
getBlockData
@NotNull public BlockData getBlockData()
Gets the BlockData that we are trying to place.- Returns:
- The BlockData that we are trying to place
-
getPlayer
@Nullable public Player getPlayer()
Gets 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
@NotNull public HandlerList getHandlers()
- Specified by:
getHandlers
in classEvent
-
getHandlerList
@NotNull public static HandlerList getHandlerList()
-
-