Class AdditiveModifier

java.lang.Object
de.Keyle.MyPet.api.skill.experience.modifier.ExperienceModifier
de.Keyle.MyPet.api.skill.experience.modifier.AdditiveModifier

public class AdditiveModifier extends ExperienceModifier
An experience modifier that adds a fixed amount to the incoming experience value.

The modifier value defaults to 0 (no change). Positive values increase experience; negative values decrease it.

Example: if a mob kill yields 10 XP and this modifier is set to 5, the result passed to the next modifier in the chain will be 15.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an additive modifier with a bonus of 0 (no-op).
    AdditiveModifier(double modifier)
    Creates an additive modifier with the specified bonus.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    The amount added to the incoming experience.
    double
    modify(double experience, double baseExperience)
    Applies this modifier to the given experience value.
    void
    setModifier(double modifier)
    The amount added to the incoming experience.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AdditiveModifier

      public AdditiveModifier(double modifier)
      Creates an additive modifier with the specified bonus.
      Parameters:
      modifier - the flat amount to add (can be negative to subtract)
    • AdditiveModifier

      public AdditiveModifier()
      Creates an additive modifier with a bonus of 0 (no-op).
  • Method Details

    • modify

      public double modify(double experience, double baseExperience)
      Applies this modifier to the given experience value. Adds the configured flat modifier value to the experience.
      Specified by:
      modify in class ExperienceModifier
      Parameters:
      experience - the experience value as modified by prior modifiers in the chain
      baseExperience - the original unmodified experience from the mob kill
      Returns:
      the modified experience value to pass to the next modifier (or to award)
    • setModifier

      public void setModifier(double modifier)
      The amount added to the incoming experience.
      Parameters:
      modifier - the new value
    • getModifier

      public double getModifier()
      The amount added to the incoming experience.
      Returns:
      the current value