Class PetCreateEvent
Source discriminates the
creation pathway: PetCreateEvent.Source.LEASH (player leashes a wild mob),
PetCreateEvent.Source.ADMIN_COMMAND (an admin /petadmin create-style command),
PetCreateEvent.Source.PET_SHOP (PetShop integration purchase), PetCreateEvent.Source.OTHER
(third-party plugins).
Fires from EntityListener (leash path), PetCreaking.HeartListener
(Creaking-specific leash path), CommandOptionCreate, and the
PetShop integration.
Not cancellable: the pet has already been added to the manager when
this event fires. Listeners can use it to award welcome bonuses, log creation,
or trigger UI flows — not to veto creation. Veto must happen earlier in the
Bukkit-event chain (PlayerLeashEntityEvent for the leash sources, the
command's permission check for admin / shop sources).
Pet state: getPet() is in the inactive-pets pool — the
pet is persisted but not yet active. Owner is set; getPlayer() may be
null only if the owner has logged off in the same tick.
Related events: PetLoadEvent fires whenever a pet is
loaded from disk (creation OR subsequent activations). PetActivatedEvent
fires after activation completes. PetRemoveEvent is the symmetric
deletion event.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionPetCreateEvent(StoredPet pet, PetCreateEvent.Source source) Creates the event for a pet that has just entered the repository. -
Method Summary
Modifier and TypeMethodDescriptionstatic HandlerListReturns the handler list for this event type.getPet()The newly created pet, already present in the repository.The pathway the pet was created through.Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
PetCreateEvent
Creates the event for a pet that has just entered the repository.- Parameters:
pet- the newly created petsource- the pathway that created it
-
-
Method Details
-
getHandlerList
Returns the handler list for this event type.- Returns:
- the shared
HandlerListeveryPetCreateEventis dispatched through
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getPet
The newly created pet, already present in the repository. -
getSource
The pathway the pet was created through.- Returns:
- the pathway that created it
-