Class InteractionEvent
java.lang.Object
org.bukkit.event.Event
io.artificial.enchantments.api.event.EnchantEffectEvent
io.artificial.enchantments.api.event.InteractionEvent
- All Implemented Interfaces:
org.bukkit.event.Cancellable
Event fired when an interaction-related enchantment effect triggers.
Carries data about the player, item, block, and entity during player interaction events (left click, right click). This event is cancellable.
- Since:
- 0.1.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionInteractionEvent(@NotNull EnchantmentDefinition enchantment, int level, double scaledValue, @NotNull org.bukkit.entity.Player player, @Nullable org.bukkit.inventory.ItemStack item, @NotNull org.bukkit.inventory.EquipmentSlot hand, @NotNull org.bukkit.Location location, @Nullable org.bukkit.block.Block block, @Nullable org.bukkit.block.BlockFace blockFace, @Nullable org.bukkit.entity.Entity targetEntity, boolean isLeftClick, boolean isRightClick, @Nullable org.bukkit.util.Vector interactionPoint) Creates a newInteractionEvent. -
Method Summary
Modifier and TypeMethodDescription@Nullable org.bukkit.block.BlockgetBlock()Gets the block interacted with.@Nullable org.bukkit.block.BlockFaceGets the block face clicked.@NotNull org.bukkit.inventory.EquipmentSlotgetHand()Gets the hand used.static @NotNull org.bukkit.event.HandlerListGets the handler list for this event type.@NotNull org.bukkit.event.HandlerList@Nullable org.bukkit.util.VectorGets the precise interaction point.@Nullable org.bukkit.inventory.ItemStackgetItem()Gets the item used.@NotNull org.bukkit.LocationGets the interaction location.@NotNull org.bukkit.entity.PlayerGets the player interacting.@Nullable org.bukkit.entity.EntityGets the entity clicked.booleanChecks if this is a block interaction.booleanbooleanChecks if this is an entity interaction.booleanChecks if this is a left click.booleanChecks if this is a right click.booleanChecks if the player is sneaking.voidsetCancelled(boolean cancelled) Methods inherited from class io.artificial.enchantments.api.event.EnchantEffectEvent
checkCancelled, getEnchantment, getLevel, getScaledValue, isCancellableMethods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
InteractionEvent
public InteractionEvent(@NotNull @NotNull EnchantmentDefinition enchantment, int level, double scaledValue, @NotNull @NotNull org.bukkit.entity.Player player, @Nullable @Nullable org.bukkit.inventory.ItemStack item, @NotNull @NotNull org.bukkit.inventory.EquipmentSlot hand, @NotNull @NotNull org.bukkit.Location location, @Nullable @Nullable org.bukkit.block.Block block, @Nullable @Nullable org.bukkit.block.BlockFace blockFace, @Nullable @Nullable org.bukkit.entity.Entity targetEntity, boolean isLeftClick, boolean isRightClick, @Nullable @Nullable org.bukkit.util.Vector interactionPoint) Creates a newInteractionEvent.- Parameters:
enchantment- the enchantment that triggered this eventlevel- the level of the enchantmentscaledValue- the scaled value from the enchantment's scaling algorithmplayer- the player interactingitem- the item used, or nullhand- the hand usedlocation- the interaction locationblock- the block interacted with, or nullblockFace- the block face clicked, or nulltargetEntity- the entity clicked, or nullisLeftClick- true if left clickisRightClick- true if right clickinteractionPoint- the precise interaction point, or null
-
-
Method Details
-
getPlayer
@NotNull public @NotNull org.bukkit.entity.Player getPlayer()Gets the player interacting.- Returns:
- the player
-
getItem
@Nullable public @Nullable org.bukkit.inventory.ItemStack getItem()Gets the item used.- Returns:
- the item, or null
-
getHand
@NotNull public @NotNull org.bukkit.inventory.EquipmentSlot getHand()Gets the hand used.- Returns:
- the hand
-
getLocation
@NotNull public @NotNull org.bukkit.Location getLocation()Gets the interaction location.- Returns:
- the location
-
getBlock
@Nullable public @Nullable org.bukkit.block.Block getBlock()Gets the block interacted with.- Returns:
- the block, or null
-
getBlockFace
@Nullable public @Nullable org.bukkit.block.BlockFace getBlockFace()Gets the block face clicked.- Returns:
- the block face, or null
-
getTargetEntity
@Nullable public @Nullable org.bukkit.entity.Entity getTargetEntity()Gets the entity clicked.- Returns:
- the target entity, or null
-
isLeftClick
public boolean isLeftClick()Checks if this is a left click.- Returns:
- true if left click
-
isRightClick
public boolean isRightClick()Checks if this is a right click.- Returns:
- true if right click
-
isBlockInteraction
public boolean isBlockInteraction()Checks if this is a block interaction.- Returns:
- true if block was clicked
-
isEntityInteraction
public boolean isEntityInteraction()Checks if this is an entity interaction.- Returns:
- true if entity was clicked
-
isSneaking
public boolean isSneaking()Checks if the player is sneaking.- Returns:
- true if sneaking
-
getInteractionPoint
@Nullable public @Nullable org.bukkit.util.Vector getInteractionPoint()Gets the precise interaction point.- Returns:
- the interaction point, or null
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceorg.bukkit.event.Cancellable
-
setCancelled
public void setCancelled(boolean cancelled) - Specified by:
setCancelledin interfaceorg.bukkit.event.Cancellable
-
getHandlers
@NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()- Specified by:
getHandlersin classEnchantEffectEvent
-
getHandlerList
@NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList()Gets the handler list for this event type.- Returns:
- the handler list
-