Package net.minestom.server.event.player
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 Summary
Constructors Constructor Description PlayerBlockInteractEvent(Player player, BlockPosition blockPosition, Player.Hand hand, BlockFace blockFace)
-
Method Summary
Modifier and Type Method Description BlockFace
getBlockFace()
Gets the block face.BlockPosition
getBlockPosition()
Gets the position of the interacted block.Player.Hand
getHand()
Gets the hand used for the interaction.Player
getPlayer()
Gets the player who interacted with the block.boolean
isBlockingItemUse()
Gets if the event should block the item use.void
setBlockingItemUse(boolean blocks)
-
Constructor Details
-
PlayerBlockInteractEvent
public PlayerBlockInteractEvent(@NotNull Player player, @NotNull BlockPosition blockPosition, @NotNull Player.Hand hand, @NotNull BlockFace blockFace)
-
-
Method Details
-
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
Gets the position of the interacted block.- Returns:
- the block position
-
getHand
Gets the hand used for the interaction.- Returns:
- the hand used
-
getBlockFace
Gets the block face.- Returns:
- the block face
-