Interface PetEventHandler<E extends Event>

Type Parameters:
E - the Bukkit event type this handler accepts
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface PetEventHandler<E extends Event>
Functional handler invoked by the central dispatcher when a Event fires on a pet whose type matches a registered PetBehavior.

The handler receives the typed event plus the already-matched pet and its live Bukkit Mob — no instanceof PetEntityMarker check, no MyPetApi.getPetManager().getPetFromEntity(...) call, no class cast. The dispatcher does all of that before invocation.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    accept(E event, Pet pet, Mob mob)
    Handles one event on one pet.
  • Method Details

    • accept

      void accept(E event, Pet pet, Mob mob)
      Handles one event on one pet. The dispatcher has already matched the pet type and resolved both the pet and its live mob.
      Parameters:
      event - the event that fired
      pet - the pet it concerns
      mob - that pet's live Bukkit mob