Package io.papermc.paper.event.entity
Class EntityLoadCrossbowEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
io.papermc.paper.event.entity.EntityLoadCrossbowEvent
- All Implemented Interfaces:
Cancellable
Called when a LivingEntity loads a crossbow with a projectile.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Field Summary
Fields inherited from class org.bukkit.event.entity.EntityEvent
entity
-
Constructor Summary
ConstructorDescriptionEntityLoadCrossbowEvent(@NotNull LivingEntity entity, @Nullable ItemStack crossbow, @NotNull EquipmentSlot hand)
-
Method Summary
Modifier and TypeMethodDescriptionGets the crossbowItemStack
being loaded.Returns the Entity involved in this eventgetHand()
Gets the hand from which the crossbow was loaded.static @NotNull HandlerList
boolean
Gets the cancellation state of this event.void
setCancelled(boolean cancel)
Set whether or not to cancel the crossbow being loaded.void
setConsumeItem(boolean consume)
boolean
Methods inherited from class org.bukkit.event.entity.EntityEvent
getEntityType
Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
EntityLoadCrossbowEvent
public EntityLoadCrossbowEvent(@NotNull @NotNull LivingEntity entity, @Nullable @Nullable ItemStack crossbow, @NotNull @NotNull EquipmentSlot hand)
-
-
Method Details
-
getEntity
Description copied from class:EntityEvent
Returns the Entity involved in this event- Overrides:
getEntity
in classEntityEvent
- Returns:
- Entity who is involved in this event
-
getCrossbow
Gets the crossbowItemStack
being loaded.- Returns:
- the crossbow involved in this event
-
getHand
Gets the hand from which the crossbow was loaded.- Returns:
- the hand
-
shouldConsumeItem
public boolean shouldConsumeItem()- Returns:
- should the itemstack be consumed
-
setConsumeItem
public void setConsumeItem(boolean consume)- Parameters:
consume
- should the item be consumed
-
isCancelled
public boolean isCancelled()Description copied from interface:Cancellable
Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins- Specified by:
isCancelled
in interfaceCancellable
- Returns:
- true if this event is cancelled
-
setCancelled
public void setCancelled(boolean cancel)Set whether or not to cancel the crossbow being loaded. If canceled, the projectile that would be loaded into the crossbow will not be consumed. If set to false, and this event is pertaining to a player entity, it's recommended that a call toPlayer.updateInventory()
is made as the client may think the server still loaded an item into the crossbow.- Specified by:
setCancelled
in interfaceCancellable
- Parameters:
cancel
- true if you wish to cancel this event
-
getHandlers
- Specified by:
getHandlers
in classEvent
-
getHandlerList
-