Class PetInventoryActionEvent

All Implemented Interfaces:
Cancellable

public class PetInventoryActionEvent extends CancellablePetEvent
Fired when something interacts with a pet's Backpack inventory. The PetInventoryActionEvent.Action discriminates the firing site:

Cancellable: cancellation suppresses the action specifically:

  • Open: the inventory UI doesn't open.
  • Pickup: the item is left on the ground.
  • Use: the item stays in the backpack instead of being equipped or consumed.

Pet state: live pet, with the owner online (Open) or near (Pickup / Use).

Related events: PetPickupItemEvent fires earlier on the Pickup path with the actual Item entity — listen to that for per-item filtering, and to this event for per-action veto control.

  • Constructor Details

    • PetInventoryActionEvent

      public PetInventoryActionEvent(Pet pet, PetInventoryActionEvent.Action action)
      Creates the event for a backpack interaction.
      Parameters:
      pet - the pet whose backpack is involved
      action - the interaction about to happen
  • Method Details

    • getHandlerList

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

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

      public Pet getPet()
      The pet whose backpack is being acted on.
      Specified by:
      getPet in class PetEvent
      Returns:
      the pet whose backpack is involved
    • getAction

      public PetInventoryActionEvent.Action getAction()
      Which backpack interaction is about to happen.
      Returns:
      the interaction about to happen