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
ConstructorsConstructorDescriptionItemExecuteEvent(org.bukkit.event.player.PlayerInteractEvent event, org.bukkit.inventory.ItemStack item, ItemInteraction interaction) Creates a new ItemExecuteEvent. -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidexecute()Executes the item interaction if the event is not cancelled.org.bukkit.event.block.ActionGets the action that triggered this event.static org.bukkit.event.HandlerListGets the handler list for this event.@NotNull org.bukkit.event.HandlerListGets the ItemInteraction that will be executed.org.bukkit.inventory.ItemStackgetItem()Gets the ItemStack that was interacted with.org.bukkit.entity.PlayerGets the player who triggered this event.booleanvoidsetCancelled(boolean cancel) Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
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 PlayerInteractEventitem- the ItemStack that was interacted withinteraction- 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:
callEventin classorg.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
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:
getHandlersin classorg.bukkit.event.Event
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceorg.bukkit.event.Cancellable
-
setCancelled
public void setCancelled(boolean cancel) - Specified by:
setCancelledin interfaceorg.bukkit.event.Cancellable
-