Interface CombatContext

All Superinterfaces:
EffectContext

public interface CombatContext extends EffectContext
Context for combat-related enchantment effects.

Provides access to attacker, victim, damage values, and combat metadata during entity damage events.

Since:
0.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addDamage(double amount)
    Adds an amount to the current damage.
    @Nullable org.bukkit.entity.LivingEntity
    Gets the attacking entity, if any.
    double
    Gets the base damage before modifiers.
    double
    Gets the current damage after modifications.
    @NotNull org.bukkit.damage.DamageSource
    Gets the Bukkit damage source.
    @NotNull org.bukkit.Location
    Gets the location where the damage occurred.
    @NotNull org.bukkit.entity.LivingEntity
    Gets the victim receiving damage.
    @Nullable org.bukkit.inventory.ItemStack
    Gets the weapon used in the attack, if any.
    boolean
    Checks if the victim is wearing armor.
    boolean
    Checks if the victim is blocking with a shield.
    boolean
    Checks if the attack was a critical hit.
    boolean
    Checks if the damage is from an explosion.
    boolean
    Checks if the damage is magical.
    boolean
    Checks if the damage is from a melee attack.
    boolean
    Checks if the damage is from a projectile.
    boolean
    Checks if the damage was fully blocked by a shield.
    void
    multiplyDamage(double factor)
    Multiplies the current damage by a factor.
    void
    setDamage(double damage)
    Sets the damage to a specific value.

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

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

    • getAttacker

      @Nullable @Nullable org.bukkit.entity.LivingEntity getAttacker()
      Gets the attacking entity, if any.
      Returns:
      the attacker, or null for environmental damage
    • getVictim

      @NotNull @NotNull org.bukkit.entity.LivingEntity getVictim()
      Gets the victim receiving damage.
      Returns:
      the victim entity
    • getLocation

      @NotNull @NotNull org.bukkit.Location getLocation()
      Gets the location where the damage occurred.
      Returns:
      the damage location
    • getWeapon

      @Nullable @Nullable org.bukkit.inventory.ItemStack getWeapon()
      Gets the weapon used in the attack, if any.
      Returns:
      the weapon item, or null if no weapon was used
    • getBaseDamage

      double getBaseDamage()
      Gets the base damage before modifiers.
      Returns:
      the base damage value
    • getCurrentDamage

      double getCurrentDamage()
      Gets the current damage after modifications.
      Returns:
      the current damage value
    • setDamage

      void setDamage(double damage)
      Sets the damage to a specific value.
      Parameters:
      damage - the new damage value
    • addDamage

      void addDamage(double amount)
      Adds an amount to the current damage.
      Parameters:
      amount - the amount to add (may be negative)
    • multiplyDamage

      void multiplyDamage(double factor)
      Multiplies the current damage by a factor.
      Parameters:
      factor - the multiplier to apply
    • getDamageSource

      @NotNull @NotNull org.bukkit.damage.DamageSource getDamageSource()
      Gets the Bukkit damage source.
      Returns:
      the damage source
    • isMelee

      boolean isMelee()
      Checks if the damage is from a melee attack.
      Returns:
      true if melee damage
    • isProjectile

      boolean isProjectile()
      Checks if the damage is from a projectile.
      Returns:
      true if projectile damage
    • isMagic

      boolean isMagic()
      Checks if the damage is magical.
      Returns:
      true if magic damage
    • isExplosion

      boolean isExplosion()
      Checks if the damage is from an explosion.
      Returns:
      true if explosion damage
    • isCritical

      boolean isCritical()
      Checks if the attack was a critical hit.
      Returns:
      true if critical
    • isBlocking

      boolean isBlocking()
      Checks if the victim is blocking with a shield.
      Returns:
      true if blocking
    • isShieldBlock

      boolean isShieldBlock()
      Checks if the damage was fully blocked by a shield.
      Returns:
      true if shield blocked
    • isArmored

      boolean isArmored()
      Checks if the victim is wearing armor.
      Returns:
      true if armored