Interface ProjectileContext

All Superinterfaces:
EffectContext

public interface ProjectileContext extends EffectContext
Context for projectile-related enchantment effects.

Provides access to projectile, shooter, launch location, hit data, and projectile physics during projectile launch and hit events.

Since:
0.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable org.bukkit.block.Block
    Gets the block hit by the projectile, if any.
    @Nullable org.bukkit.entity.Entity
    Gets the entity hit by the projectile, if any.
    @Nullable org.bukkit.util.Vector
    Gets the exact position where the projectile hit.
    @NotNull org.bukkit.Location
    Gets the location where the projectile was launched.
    int
    Gets the current pierce level.
    @NotNull org.bukkit.entity.Projectile
    Gets the projectile entity.
    @Nullable org.bukkit.entity.LivingEntity
    Gets the entity that shot the projectile.
    @NotNull org.bukkit.util.Vector
    Gets the current projectile velocity.
    @NotNull org.bukkit.inventory.ItemStack
    Gets the weapon used to launch the projectile.
    boolean
    Checks if gravity affects the projectile.
    boolean
    Checks if the projectile hit a block.
    boolean
    Checks if the projectile hit an entity.
    boolean
    Checks if this is a hit event.
    boolean
    Checks if this is a launch event.
    void
    setGravity(boolean gravity)
    Sets whether gravity affects the projectile.
    void
    setPierceLevel(int level)
    Sets the pierce level for this projectile.
    void
    setVelocity(@NotNull org.bukkit.util.Vector velocity)
    Sets the projectile velocity.

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

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

    • getProjectile

      @NotNull @NotNull org.bukkit.entity.Projectile getProjectile()
      Gets the projectile entity.
      Returns:
      the projectile
    • getShooter

      @Nullable @Nullable org.bukkit.entity.LivingEntity getShooter()
      Gets the entity that shot the projectile.
      Returns:
      the shooter, or null if launched by dispenser or other source
    • getLaunchLocation

      @NotNull @NotNull org.bukkit.Location getLaunchLocation()
      Gets the location where the projectile was launched.
      Returns:
      the launch location
    • getWeapon

      @NotNull @NotNull org.bukkit.inventory.ItemStack getWeapon()
      Gets the weapon used to launch the projectile.
      Returns:
      the weapon item
    • getHitEntity

      @Nullable @Nullable org.bukkit.entity.Entity getHitEntity()
      Gets the entity hit by the projectile, if any.
      Returns:
      the hit entity, or null
    • getHitBlock

      @Nullable @Nullable org.bukkit.block.Block getHitBlock()
      Gets the block hit by the projectile, if any.
      Returns:
      the hit block, or null
    • getHitPosition

      @Nullable @Nullable org.bukkit.util.Vector getHitPosition()
      Gets the exact position where the projectile hit.
      Returns:
      the hit position, or null
    • hasHitEntity

      boolean hasHitEntity()
      Checks if the projectile hit an entity.
      Returns:
      true if hit entity
    • hasHitBlock

      boolean hasHitBlock()
      Checks if the projectile hit a block.
      Returns:
      true if hit block
    • isLaunch

      boolean isLaunch()
      Checks if this is a launch event.
      Returns:
      true if launching
    • isHit

      boolean isHit()
      Checks if this is a hit event.
      Returns:
      true if hitting
    • setVelocity

      void setVelocity(@NotNull @NotNull org.bukkit.util.Vector velocity)
      Sets the projectile velocity.
      Parameters:
      velocity - the new velocity vector
    • getVelocity

      @NotNull @NotNull org.bukkit.util.Vector getVelocity()
      Gets the current projectile velocity.
      Returns:
      the velocity vector
    • setGravity

      void setGravity(boolean gravity)
      Sets whether gravity affects the projectile.
      Parameters:
      gravity - true for gravity
    • hasGravity

      boolean hasGravity()
      Checks if gravity affects the projectile.
      Returns:
      true if has gravity
    • setPierceLevel

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

      int getPierceLevel()
      Gets the current pierce level.
      Returns:
      the pierce level