Class PlayerBlockInteractEvent

java.lang.Object
net.minestom.server.event.Event
net.minestom.server.event.CancellableEvent
net.minestom.server.event.player.PlayerBlockInteractEvent

public class PlayerBlockInteractEvent
extends CancellableEvent
Called when a player interacts with a block (right-click). This is also called when a block is placed.
  • Constructor Details

  • Method Details

    • getPlayer

      @NotNull public Player getPlayer()
      Gets the player who interacted with the block.
      Returns:
      the player
    • isBlockingItemUse

      public boolean isBlockingItemUse()
      Gets if the event should block the item use.
      Returns:
      true if the item use is blocked, false otherwise
    • setBlockingItemUse

      public void setBlockingItemUse​(boolean blocks)
    • getBlockPosition

      @NotNull public BlockPosition getBlockPosition()
      Gets the position of the interacted block.
      Returns:
      the block position
    • getHand

      @NotNull public Player.Hand getHand()
      Gets the hand used for the interaction.
      Returns:
      the hand used
    • getBlockFace

      @NotNull public BlockFace getBlockFace()
      Gets the block face.
      Returns:
      the block face