Class PlayerUseItemOnBlockEvent

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

public class PlayerUseItemOnBlockEvent extends Object implements PlayerInstanceEvent, ItemEvent
Used when a player is clicking on a block with an item (but is not a block in item form).
  • Constructor Details

    • PlayerUseItemOnBlockEvent

      public PlayerUseItemOnBlockEvent(@NotNull @NotNull Player player, @NotNull @NotNull PlayerHand hand, @NotNull @NotNull ItemStack itemStack, @NotNull @NotNull Point position, @NotNull @NotNull Point cursorPosition, @NotNull @NotNull BlockFace blockFace)
  • Method Details

    • getPosition

      @NotNull public @NotNull Point getPosition()
      Gets the position of the interacted block.
      Returns:
      the block position
    • getBlockFace

      @NotNull public @NotNull BlockFace getBlockFace()
      Gets which face the player has interacted with.
      Returns:
      the block face
    • getHand

      @NotNull public @NotNull PlayerHand getHand()
      Gets which hand the player used to interact with the block.
      Returns:
      the hand
    • getItemStack

      @NotNull public @NotNull ItemStack getItemStack()
      Gets with which item the player has interacted with the block.
      Specified by:
      getItemStack in interface ItemEvent
      Returns:
      the item
    • getPlayer

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