Class PermissionModifier

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

public class PermissionModifier extends ExperienceModifier
An experience modifier that grants bonus experience based on the pet owner's permissions.

When the permission-based modifier feature is enabled in configuration (MyPetGlobal.LevelSystem.Experience.Modifier.PERMISSION), this modifier scans the pet owner's effective permissions for nodes of the form MyPet.experience.multiplier.<percent> where <percent> is any positive integer. The highest matching value is applied as percent / 100.0:

  • MyPet.experience.multiplier.125 → 1.25x
  • MyPet.experience.multiplier.183 → 1.83x
  • MyPet.experience.multiplier.250 → 2.5x
  • MyPet.experience.multiplier.50 → 0.5x (halved)

If the feature is disabled, the owner is offline, or no permission node matches, the experience passes through unchanged.

  • Constructor Details

    • PermissionModifier

      public PermissionModifier(Pet pet)
      Creates a permission modifier bound to the specified pet.
      Parameters:
      pet - the pet whose owner's permissions will be checked
  • Method Details

    • modify

      public double modify(double experience, double baseExperience)
      Applies this modifier to the given experience value. Applies the highest applicable permission-based multiplier.
      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)