Interface InteractionContext

All Superinterfaces:
EffectContext

public interface InteractionContext extends EffectContext
Context for player interaction enchantment effects.

Provides access to player, item, hand, block/entity targets, and interaction details during player interact events.

Since:
0.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable org.bukkit.block.Block
    Gets the block being interacted with, if any.
    @Nullable org.bukkit.block.BlockFace
    Gets the face of the block being clicked.
    @NotNull org.bukkit.inventory.EquipmentSlot
    Gets the hand used for the interaction.
    org.bukkit.util.Vector
    Gets the exact interaction point on the block/entity.
    @NotNull org.bukkit.inventory.ItemStack
    Gets the item used for the interaction.
    @NotNull org.bukkit.Location
    Gets the interaction location.
    @NotNull org.bukkit.entity.Player
    Gets the player performing the interaction.
    @Nullable org.bukkit.entity.Entity
    Gets the entity being interacted with, if any.
    boolean
    Checks if this is a block interaction.
    boolean
    Checks if this is an entity interaction.
    boolean
    Checks if this is a left-click interaction.
    boolean
    Checks if this is a right-click interaction.
    boolean
    Checks if the player is sneaking during interaction.

    Methods inherited from interface io.artificial.enchantments.api.context.EffectContext

    getEnchantment, getLevel, getScaledValue, isCancellable, isCancelled, tryCancel
  • Method Details

    • getPlayer

      @NotNull @NotNull org.bukkit.entity.Player getPlayer()
      Gets the player performing the interaction.
      Returns:
      the interacting player
    • getItem

      @NotNull @NotNull org.bukkit.inventory.ItemStack getItem()
      Gets the item used for the interaction.
      Returns:
      the item
    • getHand

      @NotNull @NotNull org.bukkit.inventory.EquipmentSlot getHand()
      Gets the hand used for the interaction.
      Returns:
      the equipment slot (hand)
    • getLocation

      @NotNull @NotNull org.bukkit.Location getLocation()
      Gets the interaction location.
      Returns:
      the location
    • isBlockInteraction

      boolean isBlockInteraction()
      Checks if this is a block interaction.
      Returns:
      true if interacting with block
    • isEntityInteraction

      boolean isEntityInteraction()
      Checks if this is an entity interaction.
      Returns:
      true if interacting with entity
    • getBlock

      @Nullable @Nullable org.bukkit.block.Block getBlock()
      Gets the block being interacted with, if any.
      Returns:
      the block, or null
    • getBlockFace

      @Nullable @Nullable org.bukkit.block.BlockFace getBlockFace()
      Gets the face of the block being clicked.
      Returns:
      the block face, or null
    • getTargetEntity

      @Nullable @Nullable org.bukkit.entity.Entity getTargetEntity()
      Gets the entity being interacted with, if any.
      Returns:
      the target entity, or null
    • isLeftClick

      boolean isLeftClick()
      Checks if this is a left-click interaction.
      Returns:
      true if left click
    • isRightClick

      boolean isRightClick()
      Checks if this is a right-click interaction.
      Returns:
      true if right click
    • isSneaking

      boolean isSneaking()
      Checks if the player is sneaking during interaction.
      Returns:
      true if sneaking
    • getInteractionPoint

      @Nullable org.bukkit.util.Vector getInteractionPoint()
      Gets the exact interaction point on the block/entity.
      Returns:
      the interaction point, or null