Class EntityLoadCrossbowEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
io.papermc.paper.event.entity.EntityLoadCrossbowEvent
All Implemented Interfaces:
Cancellable

public class EntityLoadCrossbowEvent extends EntityEvent implements Cancellable
Called when a LivingEntity loads a crossbow with a projectile.
  • Constructor Details

  • Method Details

    • getEntity

      @NotNull public @NotNull LivingEntity getEntity()
      Description copied from class: EntityEvent
      Returns the Entity involved in this event
      Overrides:
      getEntity in class EntityEvent
      Returns:
      Entity who is involved in this event
    • getCrossbow

      @Nullable public @Nullable ItemStack getCrossbow()
      Gets the crossbow ItemStack being loaded.
      Returns:
      the crossbow involved in this event
    • getHand

      @NotNull public @NotNull EquipmentSlot 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 interface Cancellable
      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 to Player.updateInventory() is made as the client may think the server still loaded an item into the crossbow.
      Specified by:
      setCancelled in interface Cancellable
      Parameters:
      cancel - true if you wish to cancel this event
    • getHandlers

      @NotNull public @NotNull HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getHandlerList

      @NotNull public static @NotNull HandlerList getHandlerList()