API reference Obsidian.API.Events
PlayerInteractEventArgs class
An event for when a player interacts with a item and/or block. You can get which hand was used by the player when interacting by checking PlayerInteractEventArgs.Hand
public sealed class PlayerInteractEventArgs : PlayerEventArgs, ICancellable
In Obsidian.API.
Constructors
public PlayerInteractEventArgs(IPlayer player, IServer server);Properties
Block
public IBlock Block { get; init; }The block that was clicked. Null if no block was clicked.
BlockLocation
public Vector? BlockLocation { get; init; }The location of the clicked block. Null if no block was clicked.
public InteractionHand Hand { get; init; }IsCancelled
public bool IsCancelled { get; }Gets a value indicating whether the default behaviour should be cancelled.
Item
public ItemStack Item { get; init; }The item that was being held when interacting.
Methods
Cancel()
public void Cancel();Sets a flag which prevents default (vanilla) behavior from executing.
Remarks
This flag only affects vanilla behavior. If you wish to prevent other handlers from running, see AsyncEventArgs.Handled.