Class endstone::PlayerInteractEvent¶
ClassList > endstone > PlayerInteractEvent
Represents an event that is called when a player right-clicks a block.
#include <endstone/event/player/player_interact_event.h>
Inherits the following classes: endstone::Cancellable
Public Static Attributes¶
Type | Name |
---|---|
const std::string | NAME = "PlayerInteractEvent" |
Public Functions¶
Type | Name |
---|---|
PlayerInteractEvent (Player & player, std::shared_ptr< ItemStack > item, std::shared_ptr< Block > block_clicked, BlockFace block_face, const Vector< float > & clicked_position) |
|
std::shared_ptr< Block > | getBlock () const Returns the clicked block. |
BlockFace | getBlockFace () const Returns the face of the block that was clicked. |
Vector< float > | getClickedPosition () const Gets the exact position on the block the player interacted with. |
virtual std::string | getEventName () override const |
std::shared_ptr< ItemStack > | getItem () const Returns the item in hand represented by this event. |
bool | hasBlock () const Check if this event involved a block. |
bool | hasItem () const Check if this event involved an item. |
~PlayerInteractEvent () override |
Public Functions inherited from endstone::Cancellable¶
Type | Name |
---|---|
virtual void | cancel () Cancel this event. A cancelled event will not be executed in the server, but will still pass to other plugins. |
virtual bool | isCancelled () const Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins. |
virtual void | setCancelled (bool cancel) Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins. |
Public Functions inherited from endstone::ICancellable¶
Type | Name |
---|---|
virtual void | cancel () = 0 |
virtual bool | isCancelled () const = 0 |
virtual void | setCancelled (bool cancel) = 0 |
virtual | ~ICancellable () = default |
Public Static Attributes Documentation¶
variable NAME¶
Public Functions Documentation¶
function PlayerInteractEvent¶
inline endstone::PlayerInteractEvent::PlayerInteractEvent (
Player & player,
std::shared_ptr< ItemStack > item,
std::shared_ptr< Block > block_clicked,
BlockFace block_face,
const Vector < float > & clicked_position
)
function getBlock¶
Returns the clicked block.
Returns:
Block returns the block clicked with this item.
function getBlockFace¶
Returns the face of the block that was clicked.
Returns:
BlockFace returns the face of the block that was clicked
function getClickedPosition¶
Gets the exact position on the block the player interacted with.
All vector components are between 0.0 and 1.0 inclusive.
Returns:
the clicked position.
function getEventName¶
Gets a user-friendly identifier for this event.
Returns:
name of this event
Implements endstone::Event::getEventName
function getItem¶
Returns the item in hand represented by this event.
Returns:
ItemStack the item used
function hasBlock¶
Check if this event involved a block.
Returns:
boolean true if it did
function hasItem¶
Check if this event involved an item.
Returns:
boolean true if it did
function ~PlayerInteractEvent¶
The documentation for this class was generated from the following file include/endstone/event/player/player_interact_event.h