Interface CombatContext
- All Superinterfaces:
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 TypeMethodDescriptionvoidaddDamage(double amount) Adds an amount to the current damage.@Nullable org.bukkit.entity.LivingEntityGets the attacking entity, if any.doubleGets the base damage before modifiers.doubleGets the current damage after modifications.@NotNull org.bukkit.damage.DamageSourceGets the Bukkit damage source.@NotNull org.bukkit.LocationGets the location where the damage occurred.@NotNull org.bukkit.entity.LivingEntityGets the victim receiving damage.@Nullable org.bukkit.inventory.ItemStackGets the weapon used in the attack, if any.booleanChecks if the victim is wearing armor.booleanChecks if the victim is blocking with a shield.booleanChecks if the attack was a critical hit.booleanChecks if the damage is from an explosion.booleanisMagic()Checks if the damage is magical.booleanisMelee()Checks if the damage is from a melee attack.booleanChecks if the damage is from a projectile.booleanChecks if the damage was fully blocked by a shield.voidmultiplyDamage(double factor) Multiplies the current damage by a factor.voidsetDamage(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
-