Class PetLevelUpEvent


public class PetLevelUpEvent extends PetLevelEvent
Fired after an experience change pushes a pet's level up. The new level is available via PetLevelEvent.getLevel() (inherited) and the previous level via fromLevel().

Fires from PetExperience#updateExp immediately after the level is recomputed — only on the up-transition. If the change crosses multiple levels at once, this event fires once with the final level and the pre-change level as fromLevel.

Not cancellable: the exp / level change has already been applied. Cancel PetExpEvent earlier in the flow to suppress the entire cascade.

Quiet flag: inherited from PetLevelEvent — propagated from the originating PetExpEvent via the experience updater.

  • Constructor Details

    • PetLevelUpEvent

      public PetLevelUpEvent(Pet pet, int level, int fromLevel, boolean beQuiet)
      Creates the event for a pet that has just gained a level.
      Parameters:
      pet - the pet that levelled up
      level - the level it now holds
      fromLevel - the level it held before
      beQuiet - true to suppress the usual player-facing messaging
  • Method Details

    • getHandlerList

      public static HandlerList getHandlerList()
      Returns the handler list for this event type.
      Returns:
      the shared HandlerList every PetLevelUpEvent is dispatched through
    • fromLevel

      public int fromLevel()
      Returns the level the pet held before this transition.
      Returns:
      the previous level
    • getHandlers

      public @NonNull HandlerList getHandlers()
      Overrides:
      getHandlers in class PetLevelEvent