Class BlockInteractionEvent

java.lang.Object
org.bukkit.event.Event
com.github.darksoulq.abyssallib.server.event.custom.block.BlockInteractionEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class BlockInteractionEvent extends org.bukkit.event.Event implements org.bukkit.event.Cancellable
An event that is triggered when a player interacts with a custom block.

This event is Cancellable, meaning the interaction can be prevented by a plugin.

  • Nested Class Summary

    Nested classes/interfaces inherited from class org.bukkit.event.Event

    org.bukkit.event.Event.Result
  • Constructor Summary

    Constructors
    Constructor
    Description
    BlockInteractionEvent(@NotNull org.bukkit.entity.Player player, @NotNull CustomBlock block, @NotNull org.bukkit.block.BlockFace face, org.bukkit.Location interaction, @NotNull org.bukkit.event.block.Action action, @Nullable org.bukkit.inventory.ItemStack item)
    Constructs a new BlockInteractionEvent.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull org.bukkit.event.block.Action
    Gets the action performed by the player (e.g., right-click, left-click).
    @NotNull CustomBlock
    Gets the block being interacted with.
    @NotNull org.bukkit.block.BlockFace
    Gets the face of the block being interacted with.
    static org.bukkit.event.HandlerList
    Provides a static method to retrieve the handler list, required by Bukkit.
    @NotNull org.bukkit.event.HandlerList
    Gets the list of handlers listening to this event.
    @Nullable org.bukkit.Location
    Gets the location where the interaction occurred.
    @Nullable org.bukkit.inventory.ItemStack
    Gets the item used by the player during the interaction.
    @NotNull org.bukkit.entity.Player
    Gets the player interacting with the block.
    boolean
    Checks whether the event is cancelled.
    void
    setCancelled(boolean cancel)
    Sets the cancellation state of this event.

    Methods inherited from class org.bukkit.event.Event

    callEvent, getEventName, isAsynchronous

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BlockInteractionEvent

      public BlockInteractionEvent(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull CustomBlock block, @NotNull @NotNull org.bukkit.block.BlockFace face, org.bukkit.Location interaction, @NotNull @NotNull org.bukkit.event.block.Action action, @Nullable @Nullable org.bukkit.inventory.ItemStack item)
      Constructs a new BlockInteractionEvent.
      Parameters:
      player - The player interacting with the block.
      block - The block being interacted with.
      face - The face of the block being interacted with.
      interaction - The location where the interaction occurred.
      action - The action performed by the player.
      item - The item used by the player during the interaction.
  • Method Details

    • getBlock

      @NotNull public @NotNull CustomBlock getBlock()
      Gets the block being interacted with.
      Returns:
      The block being interacted with.
    • getPlayer

      @NotNull public @NotNull org.bukkit.entity.Player getPlayer()
      Gets the player interacting with the block.
      Returns:
      The player interacting with the block.
    • getBlockFace

      @NotNull public @NotNull org.bukkit.block.BlockFace getBlockFace()
      Gets the face of the block being interacted with.
      Returns:
      The face of the block being interacted with.
    • getInteractionPoint

      @Nullable public @Nullable org.bukkit.Location getInteractionPoint()
      Gets the location where the interaction occurred.
      Returns:
      The location of the interaction.
    • getAction

      @NotNull public @NotNull org.bukkit.event.block.Action getAction()
      Gets the action performed by the player (e.g., right-click, left-click).
      Returns:
      The action performed by the player.
    • getItem

      @Nullable public @Nullable org.bukkit.inventory.ItemStack getItem()
      Gets the item used by the player during the interaction.
      Returns:
      The item used by the player.
    • isCancelled

      public boolean isCancelled()
      Checks whether the event is cancelled.
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
      Returns:
      true if the event is cancelled; false otherwise.
    • setCancelled

      public void setCancelled(boolean cancel)
      Sets the cancellation state of this event.
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
      Parameters:
      cancel - true to cancel the event, false to allow it to proceed.
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Gets the list of handlers listening to this event.
      Specified by:
      getHandlers in class org.bukkit.event.Event
      Returns:
      The handler list.
    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()
      Provides a static method to retrieve the handler list, required by Bukkit.
      Returns:
      The static HandlerList for this event type.