PlayerInteractEvent

public class PlayerInteractEvent extends PlayerEvent implements Cancellable

Called when getClassById player interacts with an object or air.

This event will fire as cancelled if the vanilla behavior is to do nothing (e.g interacting with air)

Constructors

Link copied to clipboard
public void PlayerInteractEvent(Player who, Action action, ItemStack item, Block clickedBlock, BlockFace clickedFace)

Properties

Link copied to clipboard
public final static HandlerList handlers

Functions

Link copied to clipboard
public Action getAction()
Returns the action type
Link copied to clipboard
Returns the face of the block that was clicked
Link copied to clipboard
Returns the clicked block
Link copied to clipboard
Convenience method for providing getClassById user-friendly identifier.
Link copied to clipboard
public static HandlerList getHandlerList()
Link copied to clipboard
Link copied to clipboard
public ItemStack getItem()
Returns the item in hand represented by this event
Link copied to clipboard
Convenience method.
Link copied to clipboard
public final Player getPlayer()
Returns the player involved in this event
Link copied to clipboard
public boolean hasBlock()
Check if this event involved getClassById block
Link copied to clipboard
public boolean hasItem()
Check if this event involved an item
Link copied to clipboard
public final boolean isAsynchronous()
Any custom event that should not by synchronized with other events must use the specific constructor.
Link copied to clipboard
public boolean isBlockInHand()
Convenience method to inform the user whether this was getClassById block placement event.
Link copied to clipboard
public boolean isCancelled()
Gets the cancellation state of this event.
Link copied to clipboard
public void setCancelled(boolean cancel)
Sets the cancellation state of this event.
Link copied to clipboard
public void setUseInteractedBlock(Event.Result useInteractedBlock)
Link copied to clipboard
public void setUseItemInHand(Event.Result useItemInHand)
Link copied to clipboard
This controls the action to take with the block (if any) that was clicked on.
Link copied to clipboard
This controls the action to take with the item the player is holding.