Package dev.lone.itemsadder.api.Events
Class CustomBlockPlaceEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
dev.lone.itemsadder.api.Events.CustomBlockPlaceEvent
- All Implemented Interfaces:
org.bukkit.event.Cancellable
public class CustomBlockPlaceEvent
extends org.bukkit.event.player.PlayerEvent
implements org.bukkit.event.Cancellable
Event called when a custom block is placed by a player.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result
-
Field Summary
Fields inherited from class org.bukkit.event.player.PlayerEvent
player
-
Constructor Summary
ConstructorsConstructorDescriptionCustomBlockPlaceEvent
(org.bukkit.event.block.BlockPlaceEvent e, Object blockItem) -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.block.Block
getBlock()
Gets the Bukkit Block associated with this CustomBlock.org.bukkit.inventory.ItemStack
Get a clone of the ItemStack of the custom block broken.static @NotNull org.bukkit.event.HandlerList
@NotNull org.bukkit.event.HandlerList
org.bukkit.inventory.ItemStack
Get the item in player hand which triggered this event.Gets the Namespace and ID in the formatnamespace:id
for this CustomBlock.org.bukkit.block.Block
Get the block against this block was placed.org.bukkit.block.BlockState
Get the blockstate which was replaced by the placement of this block.boolean
Gets the value whether the player would be allowed to build here.boolean
Gets the cancellation state of this event.void
setCancelled
(boolean cancelled) Sets the cancellation state of this event.Methods inherited from class org.bukkit.event.player.PlayerEvent
getPlayer
Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
Constructor Details
-
CustomBlockPlaceEvent
-
-
Method Details
-
isCancelled
public boolean 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- Specified by:
isCancelled
in interfaceorg.bukkit.event.Cancellable
- Returns:
- true if this event is cancelled
-
setCancelled
public void setCancelled(boolean cancelled) Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.- Specified by:
setCancelled
in interfaceorg.bukkit.event.Cancellable
- Parameters:
cancelled
- true if you wish to cancel this event
-
getHandlers
@NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()- Specified by:
getHandlers
in classorg.bukkit.event.Event
-
getHandlerList
@NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList() -
getCustomBlockItem
public org.bukkit.inventory.ItemStack getCustomBlockItem()Get a clone of the ItemStack of the custom block broken.- Returns:
- the ItemStack for the
CustomBlock
-
getNamespacedID
Gets the Namespace and ID in the formatnamespace:id
for this CustomBlock.- Returns:
- String representing the namespace and ID of the CustomBlock.
-
getBlock
public org.bukkit.block.Block getBlock()Gets the Bukkit Block associated with this CustomBlock.- Returns:
- Bukkit Block associated with the CustomBlock.
-
isCanBuild
public boolean isCanBuild()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:
- whether the server would allow a player to build here
-
getPlacedAgainst
public org.bukkit.block.Block getPlacedAgainst()Get the block against this block was placed.- Returns:
- The block against.
-
getReplacedBlockState
public org.bukkit.block.BlockState getReplacedBlockState()Get the blockstate which was replaced by the placement of this block.- Returns:
- Replaced blockstate.
-
getItemInHand
public org.bukkit.inventory.ItemStack getItemInHand()Get the item in player hand which triggered this event.- Returns:
- The item.
-