Interface InteractionContext
- All Superinterfaces:
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 TypeMethodDescription@Nullable org.bukkit.block.BlockgetBlock()Gets the block being interacted with, if any.@Nullable org.bukkit.block.BlockFaceGets the face of the block being clicked.@NotNull org.bukkit.inventory.EquipmentSlotgetHand()Gets the hand used for the interaction.org.bukkit.util.VectorGets the exact interaction point on the block/entity.@NotNull org.bukkit.inventory.ItemStackgetItem()Gets the item used for the interaction.@NotNull org.bukkit.LocationGets the interaction location.@NotNull org.bukkit.entity.PlayerGets the player performing the interaction.@Nullable org.bukkit.entity.EntityGets the entity being interacted with, if any.booleanChecks if this is a block interaction.booleanChecks if this is an entity interaction.booleanChecks if this is a left-click interaction.booleanChecks if this is a right-click interaction.booleanChecks 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
-