Package de.Keyle.MyPet.api.event
Class PetInteractEvent
java.lang.Object
org.bukkit.event.Event
de.Keyle.MyPet.api.event.PetEvent
de.Keyle.MyPet.api.event.CancellablePetEvent
de.Keyle.MyPet.api.event.PetInteractEvent
- All Implemented Interfaces:
Cancellable
- Direct Known Subclasses:
PetFeedEvent,PetSitEvent
Base class for pet right-click interaction events. Used directly only as a
type for listeners that want to catch any interaction; the built-in firing
sites all dispatch concrete subclasses.
Listeners receive instances via subclasses:
PetFeedEvent (right-click with food) and PetSitEvent
(right-click with the sit-toggle item). Listening for PetInteractEvent
is equivalent to listening for both subclasses.
Cancellable: cancellation suppresses the interaction; the concrete subclass defines what that means in detail.
Item: getItem() is the ItemStack the player was
holding when the interaction fired. May be null for interactions
that aren't item-driven — PetSitEvent (sit-toggle is non-item) is
the built-in example.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionPetInteractEvent(Pet pet, ItemStack item) Creates the event for a right-click on a pet. -
Method Summary
Modifier and TypeMethodDescriptionstatic HandlerListReturns the handler list for this event type.getItem()The item the player was holding, ornullfor an interaction that is not item-driven (PetSitEventis the built-in example).getPet()The pet being interacted with.Methods inherited from class de.Keyle.MyPet.api.event.CancellablePetEvent
isCancelled, setCancelledMethods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
PetInteractEvent
Creates the event for a right-click on a pet.- Parameters:
pet- the pet being interacted withitem- the held item, ornullif the interaction is not item-driven
-
-
Method Details
-
getHandlerList
Returns the handler list for this event type.- Returns:
- the shared
HandlerListeveryPetInteractEventis dispatched through
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getPet
The pet being interacted with. -
getItem
The item the player was holding, ornullfor an interaction that is not item-driven (PetSitEventis the built-in example).- Returns:
- the held item, or
nullwhen the interaction is not item-driven
-