Class PetSendAwayEvent

All Implemented Interfaces:
Cancellable

public class PetSendAwayEvent extends CancellablePetEvent
Fired when an owner runs /mypet sendaway — the symmetric counterpart of PetCallEvent. Despawns the world entity but keeps the pet active in the manager (i.e., the owner can call it back without re-loading from disk).

Fires from CommandSendAway.

Cancellable: cancelling the event leaves the pet entity in the world. Common addon use-cases: region-locked pets that can't be dismissed inside arenas, anti-grief gates against dismissal in PvP zones.

Pet state: live pet, with the owner online (the command requires it). After successful dispatch, the entity is removed from the world but getPet() continues to refer to a live Pet until its owner logs out (the periodic save flushes it back to persisted form).

Pet exposure: always a live Pet — the pet is active and its world entity is about to be despawned.

  • Constructor Details

    • PetSendAwayEvent

      public PetSendAwayEvent(Pet pet)
      Creates the event for a pet being dismissed from the world.
      Parameters:
      pet - the pet being sent away
  • Method Details

    • getHandlerList

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

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

      public Pet getPet()
      The pet whose world entity is about to be despawned.
      Specified by:
      getPet in class PetEvent
      Returns:
      the pet being sent away