Class PetSelectSkilltreeEvent

java.lang.Object
org.bukkit.event.Event
de.Keyle.MyPet.api.event.PetEvent
de.Keyle.MyPet.api.event.PetSelectSkilltreeEvent

public class PetSelectSkilltreeEvent extends PetEvent
Fired when a pet has a skilltree assigned. PetSelectSkilltreeEvent.Source discriminates the origin of the assignment:

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.

  • 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 skilltree
      skilltree - the assigned skilltree
      source - the pathway that assigned it
  • Method Details

    • getHandlerList

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

      public @NonNull HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getPet

      public StoredPet getPet()
      The pet receiving the skilltree.
      Specified by:
      getPet in class PetEvent
      Returns:
      the pet receiving the skilltree
    • getSkilltree

      public Skilltree getSkilltree()
      The skilltree that has been assigned.
      Returns:
      the assigned skilltree
    • getSource

      public PetSelectSkilltreeEvent.Source getSource()
      The pathway the assignment came through.
      Returns:
      the pathway that assigned it