Package de.Keyle.MyPet.api.event
Class PetInventoryActionEvent
java.lang.Object
org.bukkit.event.Event
de.Keyle.MyPet.api.event.PetEvent
de.Keyle.MyPet.api.event.CancellablePetEvent
de.Keyle.MyPet.api.event.PetInventoryActionEvent
- All Implemented Interfaces:
Cancellable
Fired when something interacts with a pet's Backpack inventory. The
PetInventoryActionEvent.Action discriminates the firing site:
PetInventoryActionEvent.Action.OPEN— fires fromBackpackImplwhen an owner opens the backpack UI (/mypet inventoryor right-click with the open-backpack item).PetInventoryActionEvent.Action.PICKUP— fires fromPickupImplwhen a Pickup skill grab is about to deposit an item into the backpack.PetInventoryActionEvent.Action.USE— fires fromPickupImplwhen the pet would use a stored item (e.g., equip armor, eat food) instead of dropping it.
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhat is being done to the backpack.Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionPetInventoryActionEvent(Pet pet, PetInventoryActionEvent.Action action) Creates the event for a backpack interaction. -
Method Summary
Modifier and TypeMethodDescriptionWhich backpack interaction is about to happen.static HandlerListReturns the handler list for this event type.getPet()The pet whose backpack is being acted on.Methods inherited from class de.Keyle.MyPet.api.event.CancellablePetEvent
isCancelled, setCancelledMethods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
PetInventoryActionEvent
Creates the event for a backpack interaction.- Parameters:
pet- the pet whose backpack is involvedaction- the interaction about to happen
-
-
Method Details
-
getHandlerList
Returns the handler list for this event type.- Returns:
- the shared
HandlerListeveryPetInventoryActionEventis dispatched through
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getPet
The pet whose backpack is being acted on. -
getAction
Which backpack interaction is about to happen.- Returns:
- the interaction about to happen
-