Class PlayerCancelItemUseEvent

java.lang.Object
net.minestom.server.event.item.PlayerCancelItemUseEvent
All Implemented Interfaces:
Event, EntityEvent, EntityInstanceEvent, InstanceEvent, ItemEvent, PlayerEvent, PlayerInstanceEvent

public class PlayerCancelItemUseEvent extends Object implements PlayerInstanceEvent, ItemEvent
Called when a player stops using an item before the item has completed its usage, including the amount of time the item was used before cancellation.

This includes cases like half eating a food, but also includes shooting a bow.

  • Constructor Details

    • PlayerCancelItemUseEvent

      public PlayerCancelItemUseEvent(@NotNull @NotNull Player player, @NotNull @NotNull PlayerHand hand, @NotNull @NotNull ItemStack itemStack, long useDuration)
  • Method Details

    • getPlayer

      @NotNull public @NotNull Player getPlayer()
      Description copied from interface: PlayerEvent
      Gets the player.
      Specified by:
      getPlayer in interface PlayerEvent
      Returns:
      the player
    • getHand

      @NotNull public @NotNull PlayerHand getHand()
    • getItemStack

      @NotNull public @NotNull ItemStack getItemStack()
      Specified by:
      getItemStack in interface ItemEvent
    • getUseDuration

      public long getUseDuration()