Package de.Keyle.MyPet.api.event
Class PetLevelEvent
java.lang.Object
org.bukkit.event.Event
de.Keyle.MyPet.api.event.PetEvent
de.Keyle.MyPet.api.event.PetLevelEvent
- Direct Known Subclasses:
PetLevelDownEvent,PetLevelUpEvent
Common parent for level-transition events. Not directly fired — listeners
should subscribe to the concrete subclasses
PetLevelUpEvent and
PetLevelDownEvent, which fire from PetExperience#updateExp
on real level transitions and carry the previous level via
fromLevel().
Not cancellable: the level change has already been applied when
the subclass events fire. Cancel the upstream PetExpEvent to
suppress the cascade.
Quiet flag: isQuiet() mirrors the originating
PetExpEvent's quiet preference, propagated through the experience
updater.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionPetLevelEvent(Pet pet, int level) Deprecated, for removal: This API element is subject to removal in a future version.PetLevelEvent(Pet pet, int level, boolean beQuiet) Creates a level event. -
Method Summary
Modifier and TypeMethodDescriptionstatic HandlerListReturns the handler list for this event type.intgetLevel()The level the pet holds after the transition.getPet()The pet whose level changed.booleanisQuiet()Returns whether the originatingPetExpEventasked for the change to be silent.Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
PetLevelEvent
Deprecated, for removal: This API element is subject to removal in a future version.nothing in MyPet calls this and it silently forcesisQuiet()totrue; usePetLevelEvent(Pet, int, boolean)and state the quiet flagCreates a quiet level event.- Parameters:
pet- the pet whose level changedlevel- the level it now holds
-
PetLevelEvent
Creates a level event.- Parameters:
pet- the pet whose level changedlevel- the level it now holdsbeQuiet-trueto suppress the usual player-facing messaging
-
-
Method Details
-
getHandlerList
Returns the handler list for this event type.- Returns:
- the shared
HandlerListeveryPetLevelEventis dispatched through
-
isQuiet
public boolean isQuiet()Returns whether the originatingPetExpEventasked for the change to be silent.- Returns:
trueif player-facing messaging should be suppressed
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getPet
The pet whose level changed. -
getLevel
public int getLevel()The level the pet holds after the transition.- Returns:
- the level it now holds
-
isQuiet()totrue; usePetLevelEvent(Pet, int, boolean)and state the quiet flag