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::PlayerEvent
Public Static Attributes¶
Type | Name |
---|---|
const std::string | NAME = = "PlayerInteractEvent" |
Public Functions¶
Type | Name |
---|---|
PlayerInteractEvent (Player & player, std::unique_ptr< ItemStack > item, std::unique_ptr< Block > block_clicked, BlockFace block_face, const Vector< float > & clicked_position) |
|
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 |
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. |
virtual bool | isCancellable () override const |
~PlayerInteractEvent () override |
Public Functions inherited from endstone::PlayerEvent¶
Type | Name |
---|---|
PlayerEvent (Player & player) |
|
Player & | getPlayer () const |
~PlayerEvent () override |
Public Functions inherited from endstone::Event¶
See endstone::Event
Type | Name |
---|---|
Event (bool async=false) |
|
Event (const Event &) = delete |
|
virtual std::string | getEventName () const = 0 |
bool | isAsynchronous () const |
virtual bool | isCancellable () const = 0 |
bool | isCancelled () const |
Event & | operator= (const Event &) = delete |
void | setCancelled (bool cancel) |
virtual | ~Event () = default |
Public Static Attributes Documentation¶
variable NAME¶
Public Functions Documentation¶
function PlayerInteractEvent¶
inline endstone::PlayerInteractEvent::PlayerInteractEvent (
Player & player,
std::unique_ptr< ItemStack > item,
std::unique_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 isCancellable¶
Whether the event can be cancelled by a plugin or the server.
Returns:
true if this event can be cancelled
Implements endstone::Event::isCancellable
function ~PlayerInteractEvent¶
The documentation for this class was generated from the following file include/endstone/event/player/player_interact_event.h