Package dev.lone.itemsadder.api.Events
Class CustomBlockInteractEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
dev.lone.itemsadder.api.Events.CustomBlockInteractEvent
- All Implemented Interfaces:
org.bukkit.event.Cancellable
public class CustomBlockInteractEvent
extends org.bukkit.event.player.PlayerEvent
implements org.bukkit.event.Cancellable
Event called when a player interacts with a custom block.
-
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
ConstructorsConstructorDescriptionCustomBlockInteractEvent(org.bukkit.entity.Player player, org.bukkit.event.block.Action action, org.bukkit.inventory.ItemStack item, org.bukkit.block.Block block, org.bukkit.block.BlockFace blockFace, org.bukkit.inventory.EquipmentSlot slot, Object internal) -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.event.block.ActionReturns the action typeorg.bukkit.block.BlockReturn the block clickedorg.bukkit.block.BlockFaceGet the face on the clicked blockorg.bukkit.inventory.ItemStackGet a clone of the ItemStack of the custom block broken.org.bukkit.inventory.EquipmentSlotgetHand()Gets the hand which placed the blockstatic @NotNull org.bukkit.event.HandlerList@NotNull org.bukkit.event.HandlerListorg.bukkit.inventory.ItemStackgetItem()Returns the item in hand represented by this eventGets the Namespace and ID in the formatnamespace:idfor this CustomBlock.booleanGets the cancellation state of this event.voidsetCancelled(boolean cancelled) Sets the cancellation state of this event.Methods inherited from class org.bukkit.event.player.PlayerEvent
getPlayerMethods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
Constructor Details
-
CustomBlockInteractEvent
public CustomBlockInteractEvent(org.bukkit.entity.Player player, org.bukkit.event.block.Action action, org.bukkit.inventory.ItemStack item, org.bukkit.block.Block block, org.bukkit.block.BlockFace blockFace, org.bukkit.inventory.EquipmentSlot slot, Object internal)
-
-
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:
isCancelledin 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:
setCancelledin 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:
getHandlersin 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:idfor this CustomBlock.- Returns:
- String representing the namespace and ID of the CustomBlock.
-
getItem
public org.bukkit.inventory.ItemStack getItem()Returns the item in hand represented by this event- Returns:
- ItemStack the item used
-
getAction
public org.bukkit.event.block.Action getAction()Returns the action type- Returns:
- Action returns the type of interaction
-
getBlockClicked
public org.bukkit.block.Block getBlockClicked()Return the block clicked- Returns:
- the clicked block
-
getBlockFace
public org.bukkit.block.BlockFace getBlockFace()Get the face on the clicked block- Returns:
- the clicked face
-
getHand
public org.bukkit.inventory.EquipmentSlot getHand()Gets the hand which placed the block- Returns:
- Main or off-hand, depending on which hand was used to place the block
-