Package de.Keyle.MyPet.api.event
Class PetSaveEvent
java.lang.Object
org.bukkit.event.Event
de.Keyle.MyPet.api.event.PetEvent
de.Keyle.MyPet.api.event.PetSaveEvent
Fired when a pet's persisted state is being written to the repository.
Fires from numerous code paths that flush state to disk:
PetManager— periodic global save and the deactivation save on owner-quit.CommandTrade— pet ownership transfer.CommandOptionClone— admin pet clone.CommandOptionCreate— admin pet creation.EntityListener,PetCreaking.HeartListener— leash creation paths (alongside the correspondingPetCreateEvent).
Not cancellable: the save will proceed regardless of listeners.
The pet exposed via getPet() is in the state about to be (or
already being) serialized — listeners may inspect it for backup integrations
or last-write metadata.
Pet state: may be live (Pet) or persisted
(PersistedPet); the manager-side periodic save flushes both
categories and dispatches one event per pet.
Frequency note: on a busy server the manager-side flush can fire this event hundreds of times in a tight loop. Listeners that do non-trivial work should defer it (e.g., enqueue UUID for a delayed batch) rather than blocking the save loop.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionPetSaveEvent(StoredPet pet) Creates the event for a pet whose state is being written out. -
Method Summary
Modifier and TypeMethodDescriptionstatic HandlerListReturns the handler list for this event type.getPet()The pet in the exact state about to be serialized.Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
PetSaveEvent
Creates the event for a pet whose state is being written out.- Parameters:
pet- the pet being saved
-
-
Method Details
-
getHandlerList
Returns the handler list for this event type.- Returns:
- the shared
HandlerListeveryPetSaveEventis dispatched through
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getPet
The pet in the exact state about to be serialized.
-