Class ItemExecuteEvent

java.lang.Object
org.bukkit.event.Event
com.github.pinont.singularitylib.api.event.ItemExecuteEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class ItemExecuteEvent extends org.bukkit.event.Event implements org.bukkit.event.Cancellable
Event that is fired when a player executes an item interaction. This event allows for listening to and potentially cancelling item interactions.
  • Nested Class Summary

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

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

    Constructors
    Constructor
    Description
    ItemExecuteEvent(org.bukkit.event.player.PlayerInteractEvent event, org.bukkit.inventory.ItemStack item, ItemInteraction interaction)
    Creates a new ItemExecuteEvent.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    void
    Executes the item interaction if the event is not cancelled.
    org.bukkit.event.block.Action
    Gets the action that triggered this event.
    static org.bukkit.event.HandlerList
    Gets the handler list for this event.
    @NotNull org.bukkit.event.HandlerList
     
    Gets the ItemInteraction that will be executed.
    org.bukkit.inventory.ItemStack
    Gets the ItemStack that was interacted with.
    org.bukkit.entity.Player
    Gets the player who triggered this event.
    boolean
     
    void
    setCancelled(boolean cancel)
     

    Methods inherited from class org.bukkit.event.Event

    getEventName, isAsynchronous

    Methods inherited from class Object

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

    • ItemExecuteEvent

      public ItemExecuteEvent(org.bukkit.event.player.PlayerInteractEvent event, org.bukkit.inventory.ItemStack item, ItemInteraction interaction)
      Creates a new ItemExecuteEvent.
      Parameters:
      event - the original PlayerInteractEvent
      item - the ItemStack that was interacted with
      interaction - the ItemInteraction that will be executed
  • Method Details

    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()
      Gets the handler list for this event.
      Returns:
      the handler list
    • callEvent

      public boolean callEvent()
      Overrides:
      callEvent in class org.bukkit.event.Event
    • execute

      public void execute()
      Executes the item interaction if the event is not cancelled. Will consume the item if the player is not in creative mode.
    • getPlayer

      public org.bukkit.entity.Player getPlayer()
      Gets the player who triggered this event.
      Returns:
      the player
    • getItem

      public org.bukkit.inventory.ItemStack getItem()
      Gets the ItemStack that was interacted with.
      Returns:
      the ItemStack
    • getInteraction

      public ItemInteraction getInteraction()
      Gets the ItemInteraction that will be executed.
      Returns:
      the ItemInteraction
    • getAction

      public org.bukkit.event.block.Action getAction()
      Gets the action that triggered this event.
      Returns:
      the Action
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Specified by:
      getHandlers in class org.bukkit.event.Event
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
    • setCancelled

      public void setCancelled(boolean cancel)
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable