Interface WeaponContext
- All Superinterfaces:
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 TypeMethodDescriptionfloatgetForce()Gets the force/draw strength of the shot (0.0 to 1.0).@NotNull org.bukkit.LocationGets the location where the weapon was used.intGets the pierce level for this projectile.@Nullable org.bukkit.entity.PlayerGets the player using the weapon.@Nullable org.bukkit.entity.ProjectileGets the projectile being launched.@Nullable org.bukkit.entity.LivingEntityGets the target entity, if any.@NotNull org.bukkit.inventory.ItemStackGets the weapon item being used.booleanisBow()Checks if the weapon is a bow.booleanChecks if this shot is a critical hit.booleanChecks if the weapon is a crossbow.booleanChecks if the weapon is currently shooting.booleanChecks if the weapon is being thrown.booleanChecks if the weapon is a trident.voidsetCritical(boolean critical) Sets whether this shot is a critical hit.voidsetForce(float force) Sets the force/draw strength of the shot.voidsetPierceLevel(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
-