Class BURNING
- Direct Known Subclasses:
FLAGRANTE_BURNING
The BURNING effect inflicts continuous fire damage to the target player at regular intervals (every 3 seconds). Damage is calculated from the effect's duration parameter (damage = duration / 100) and is clamped to a range of 0.5 to 10 health points per tick. The effect applies smoke particle effects and fire hurt sounds with each damage instance, and prevents the player from being killed by fire (ensures health stays above 1).
Mechanism:
- Initial damage calculated as: duration / 100 (clamped to 0.5-10 range)
- Damage applied every 3 seconds (damageFrequencyInSeconds)
- Cooldown tracked per tick (damageCooldown decrement)
- Death prevention: damage won't reduce health below 1
- Visual effects: smoke particles and fire hurt sound each damage tick
- Detectable by information and mind-reading spells
- Damage can be adjusted dynamically with addDamage() and removeDamage()
-
Field Summary
Fields inherited from class net.pottercraft.ollivanders2.effect.O2Effect
affectedPlayerText, duration, effectType, informousText, kill, legilimensText, p, permanent, targetID -
Constructor Summary
ConstructorsConstructorDescriptionBURNING(@NotNull Ollivanders2 plugin, int duration, boolean isPermanent, @NotNull UUID pid) Constructor for creating a burning fire damage effect. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDamage(double d) Adjust the damage done by this burning effect with clamping to bounds.voidAge the effect and apply periodic damage based on cooldown countdown.voiddoRemove()Perform cleanup when the burning effect is removed.doubleGet the current damage per tick inflicted by this burning effect.voidremoveDamage(double d) Reduce the damage done by this burning effect.Methods inherited from class net.pottercraft.ollivanders2.effect.O2Effect
age, getAffectedPlayerText, getInformousText, getLegilimensText, getMaxDuration, getMinDuration, getRemainingDuration, getTargetID, isKilled, isPermanent, kill, setPermanent
-
Constructor Details
-
BURNING
public BURNING(@NotNull @NotNull Ollivanders2 plugin, int duration, boolean isPermanent, @NotNull @NotNull UUID pid) Constructor for creating a burning fire damage effect.Creates an effect that applies periodic fire damage to the target player. Initial damage is calculated from the duration parameter using the formula: damage = duration / 100. The calculated damage is not clamped at this point but will be clamped to [0.5, 10] range when adjusted via addDamage(). Detection text is set to "is afflicted with a terrible burning" for both information and mind-reading spells.
- Parameters:
plugin- a callback to the MC pluginduration- the duration of the effect in game ticks (used to calculate initial damage as duration / 100)isPermanent- is this effect permanent (does not age)pid- the unique ID of the player to burn
-
-
Method Details
-
checkEffect
public void checkEffect()Age the effect and apply periodic damage based on cooldown countdown.Called each game tick. This method:
- Ages the effect (decrements duration until expiration)
- Checks if the target player still exists; kills effect if not
- Checks if damageCooldown has reached 0 or below
- If cooldown reached: applies damage via doDamage() and resets damageCooldown
- If cooldown not reached: decrements damageCooldown by 1
- Specified by:
checkEffectin classO2Effect
-
addDamage
public void addDamage(double d) Adjust the damage done by this burning effect with clamping to bounds.Increases (or decreases, if d is negative) the current damage value, then clamps it to the valid range [minDamage, maxDamage] (0.5 to 10). The damage value is also stored in the duration field as (damage × 100) to preserve the value during effect serialization and allow recovery after deserialization.
- Parameters:
d- the amount to adjust damage by (positive increases, negative decreases)
-
removeDamage
public void removeDamage(double d) Reduce the damage done by this burning effect.Convenience method that calls addDamage() with the negative of the parameter, effectively reducing the current damage by the specified amount. The damage is clamped to [0.5, 10] range after adjustment.
- Parameters:
d- the amount to decrease the damage by (will be negated before calling addDamage())
-
getDamage
public double getDamage()Get the current damage per tick inflicted by this burning effect.- Returns:
- the current damage amount (0.5 to 10 health points)
-
doRemove
public void doRemove()Perform cleanup when the burning effect is removed.The burning effect has no persistent state to clean up. The fire damage simply ceases when the effect is removed, and no additional cleanup is required.
-