Class O2EffectAntidoteSuper

java.lang.Object
net.pottercraft.ollivanders2.effect.O2Effect
net.pottercraft.ollivanders2.effect.O2EffectAntidoteSuper
Direct Known Subclasses:
AWAKE_ANTIDOTE_LESSER, BABBLING_ANTIDOTE_LESSER

public abstract class O2EffectAntidoteSuper extends O2Effect
Abstract base class for antidote effects that counteract other magical effects.

An antidote is a special type of effect that, when applied, immediately reduces or completely cancels another active effect on the target player. Antidotes work on a strength scale (0.0 to 1.0+):

  • strength = 1.0: Completely removes the target effect
  • strength = 0.5: Reduces the target effect's duration by 50%
  • strength = 0.25: Reduces the target effect's duration by 25%
  • strength > 1.0: Completely removes the target effect (same as 1.0)

Antidotes execute their effect immediately in checkEffect() on the first tick, then kill themselves. If the target player does not have the effect being countered, the antidote simply expires without doing anything.

See Also:
  • Constructor Details

    • O2EffectAntidoteSuper

      public O2EffectAntidoteSuper(@NotNull @NotNull Ollivanders2 plugin, int duration, boolean isPermanent, @NotNull @NotNull UUID pid)
      Constructor for creating an antidote effect.

      Creates an antidote that will immediately neutralize a target effect on the first tick. The duration parameter is provided for API consistency but antidotes are instant-acting effects that kill themselves immediately after application.

      Parameters:
      plugin - a reference to the plugin for API access and logging
      duration - ignored - antidotes apply immediately and do not persist
      isPermanent - ignored - antidotes are immediately applied and resolved
      pid - the unique ID of the target player who will receive the antidote
  • Method Details

    • checkEffect

      public void checkEffect()
      Apply the antidote effect and immediately kill this effect.

      Checks if the target player has the effect specified in o2EffectType active. If found, applies the antidote based on strength:

      • If strength ≥ 1.0: Completely removes the target effect
      • If strength < 1.0: Reduces the target effect's remaining duration by the percentage specified

      If the target effect is not found on the player, does nothing. In either case, this antidote effect immediately kills itself to prevent re-execution.

      Specified by:
      checkEffect in class O2Effect
    • getStrength

      public double getStrength()
      Get the strength/potency of this antidote effect.

      Returns a value between 0.0 and 1.0+ that determines how effectively this antidote counteracts the target effect:

      • strength ≥ 1.0: Full-strength antidote - completely removes the target effect
      • 0.5 ≤ strength < 1.0: Medium-strength antidote - reduces target effect duration by 50-99%
      • 0.0 < strength < 0.5: Weak antidote - reduces target effect duration by less than 50%
      Returns:
      the antidote strength as a decimal value (0.0 to 1.0+)
    • setPermanent

      public void setPermanent(boolean perm)
      Overridden to prevent changing permanent status - antidotes are always permanent during execution.

      Antidotes are designed as instant-acting effects that apply their counter-effect immediately and then kill themselves on the first tick. The permanent flag is set internally to ensure the effect is not aged or expired prematurely before checkEffect() has a chance to execute. Attempts to change the permanent status are silently ignored.

      Overrides:
      setPermanent in class O2Effect
      Parameters:
      perm - the requested permanent status (ignored - antidotes are always internally set as permanent)