Package de.Keyle.MyPet.api.event
Class PetSelectSkilltreeEvent
java.lang.Object
org.bukkit.event.Event
de.Keyle.MyPet.api.event.PetEvent
de.Keyle.MyPet.api.event.PetSelectSkilltreeEvent
Fired when a pet has a skilltree assigned.
PetSelectSkilltreeEvent.Source discriminates the
origin of the assignment:
PetSelectSkilltreeEvent.Source.AUTO— automatic assignment (e.g., only one tree configured for the world group, or default-tree fallback).PetSelectSkilltreeEvent.Source.PLAYER_COMMAND— owner ran/mypet skilltree.PetSelectSkilltreeEvent.Source.ADMIN_COMMAND— admin-initiated assignment via/petadmin skilltree.PetSelectSkilltreeEvent.Source.ADMIN_CREATION— admin pet creation flow assigning the initial tree.PetSelectSkilltreeEvent.Source.OTHER— fallback for any other path.
Fires from Pet on every skilltree assignment and from
CommandOptionCreate during admin pet creation.
Not cancellable: the assignment has already been written when this event fires. To restrict who can pick which tree, gate the command's permission check; to react to the change (e.g., announce, log, refund the old tree's prerequisites), listen here.
Pet state: may be live or persisted depending on the source —
AdminCreation typically fires while the pet is still inactive.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumHow a skilltree came to be assigned.Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionPetSelectSkilltreeEvent(StoredPet pet, Skilltree skilltree, PetSelectSkilltreeEvent.Source source) Creates the event for a skilltree assignment that has just been written. -
Method Summary
Modifier and TypeMethodDescriptionstatic HandlerListReturns the handler list for this event type.getPet()The pet receiving the skilltree.The skilltree that has been assigned.The pathway the assignment came through.Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
PetSelectSkilltreeEvent
public PetSelectSkilltreeEvent(StoredPet pet, Skilltree skilltree, PetSelectSkilltreeEvent.Source source) Creates the event for a skilltree assignment that has just been written.- Parameters:
pet- the pet receiving the skilltreeskilltree- the assigned skilltreesource- the pathway that assigned it
-
-
Method Details
-
getHandlerList
Returns the handler list for this event type.- Returns:
- the shared
HandlerListeveryPetSelectSkilltreeEventis dispatched through
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getPet
The pet receiving the skilltree. -
getSkilltree
The skilltree that has been assigned.- Returns:
- the assigned skilltree
-
getSource
The pathway the assignment came through.- Returns:
- the pathway that assigned it
-