The PlayerInteractEvent is the base class of LeftClickBlockEvent and RightClickBlockEvent.
The PlayerInteractEvent class is a subtype of the Event class and inherits all its properties and functions.
Here is an overview of the PlayerInteractEvent properties:
Property | Type | read / write |
---|---|---|
face | string | r |
hand | string | r |
item | Item | r |
player | Player | r |
pos | Vec3 | r |
Below you find short descriptions about each of the properties and some examples about how to use them in your spells.
The face of the block that was clicked at. Can be one of ‘up’, ‘down’, ‘north’, ‘east’, ‘south’, and ‘west’.
The hand the player used to hit the block. Can be ‘MAIN_HAND’ or ‘OFF_HAND’.
The item in the player’s hand.
The player that triggered this event.
The block’s position.