Interface WeaponContext

All Superinterfaces:
EffectContext

public interface WeaponContext extends EffectContext
Context for weapon-related enchantment effects.

Provides access to player, weapon, target, projectile, and force data during ranged weapon usage events such as bow shots, crossbow shots, and trident throws.

Since:
0.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Gets the force/draw strength of the shot (0.0 to 1.0).
    @NotNull org.bukkit.Location
    Gets the location where the weapon was used.
    int
    Gets the pierce level for this projectile.
    @Nullable org.bukkit.entity.Player
    Gets the player using the weapon.
    @Nullable org.bukkit.entity.Projectile
    Gets the projectile being launched.
    @Nullable org.bukkit.entity.LivingEntity
    Gets the target entity, if any.
    @NotNull org.bukkit.inventory.ItemStack
    Gets the weapon item being used.
    boolean
    Checks if the weapon is a bow.
    boolean
    Checks if this shot is a critical hit.
    boolean
    Checks if the weapon is a crossbow.
    boolean
    Checks if the weapon is currently shooting.
    boolean
    Checks if the weapon is being thrown.
    boolean
    Checks if the weapon is a trident.
    void
    setCritical(boolean critical)
    Sets whether this shot is a critical hit.
    void
    setForce(float force)
    Sets the force/draw strength of the shot.
    void
    setPierceLevel(int level)
    Sets the pierce level for this projectile.

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

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

    • getPlayer

      @Nullable @Nullable org.bukkit.entity.Player getPlayer()
      Gets the player using the weapon.
      Returns:
      the player, or null if launched by non-player entity
    • getWeapon

      @NotNull @NotNull org.bukkit.inventory.ItemStack getWeapon()
      Gets the weapon item being used.
      Returns:
      the weapon item
    • getLocation

      @NotNull @NotNull org.bukkit.Location getLocation()
      Gets the location where the weapon was used.
      Returns:
      the launch location
    • getTarget

      @Nullable @Nullable org.bukkit.entity.LivingEntity getTarget()
      Gets the target entity, if any.
      Returns:
      the target entity, or null if no target
    • getProjectile

      @Nullable @Nullable org.bukkit.entity.Projectile getProjectile()
      Gets the projectile being launched.
      Returns:
      the projectile entity, or null if not yet launched
    • isBow

      boolean isBow()
      Checks if the weapon is a bow.
      Returns:
      true if bow
    • isCrossbow

      boolean isCrossbow()
      Checks if the weapon is a crossbow.
      Returns:
      true if crossbow
    • isTrident

      boolean isTrident()
      Checks if the weapon is a trident.
      Returns:
      true if trident
    • isShooting

      boolean isShooting()
      Checks if the weapon is currently shooting.
      Returns:
      true if shooting
    • isThrowing

      boolean isThrowing()
      Checks if the weapon is being thrown.
      Returns:
      true if throwing
    • getForce

      float getForce()
      Gets the force/draw strength of the shot (0.0 to 1.0).
      Returns:
      the force value
    • setForce

      void setForce(float force)
      Sets the force/draw strength of the shot.
      Parameters:
      force - the new force value
    • isCritical

      boolean isCritical()
      Checks if this shot is a critical hit.
      Returns:
      true if critical
    • setCritical

      void setCritical(boolean critical)
      Sets whether this shot is a critical hit.
      Parameters:
      critical - true to make critical
    • getPierceLevel

      int getPierceLevel()
      Gets the pierce level for this projectile.
      Returns:
      the pierce level
    • setPierceLevel

      void setPierceLevel(int level)
      Sets the pierce level for this projectile.
      Parameters:
      level - the new pierce level