Class endstone::PlayerArmSwingEvent¶
ClassList > endstone > PlayerArmSwingEvent
Called when a player swings their arm. More...
#include <endstone/event/player/player_arm_swing_event.h>
Inherits the following classes: endstone::Cancellable
Public Functions¶
| Type | Name |
|---|---|
| ENDSTONE_EVENT (PlayerArmSwingEvent) |
|
| PlayerArmSwingEvent (const NotNull< Player > & player, std::optional< ItemStack > item) |
|
| const std::optional< ItemStack > & | getItem () const Gets the item the player was holding when they swung their arm. |
Public Functions inherited from endstone::Cancellable¶
| Type | Name |
|---|---|
| virtual void | cancel () Cancel this event. |
| virtual bool | isCancelled () override const Gets the cancellation state of this event. |
| virtual void | setCancelled (bool cancel) override Sets the cancellation state of this event. |
Public Functions inherited from endstone::ICancellable¶
| Type | Name |
|---|---|
| virtual void | cancel () = 0 Cancels this event. |
| virtual bool | isCancelled () const = 0 Gets the cancellation state of this event. |
| virtual void | setCancelled (bool cancel) = 0 Sets the cancellation state of this event. |
| virtual | ~ICancellable () = default |
Detailed Description¶
Cancelling stops the server acting on the swing at all. The swing is neither recorded nor shown to the other players in the dimension.
Note:
The swinging player still sees their own arm move, because their client plays the animation without waiting for the server. The event covers swings the player starts. Swings the server drives itself, such as dropping an item, do not fire it.
Public Functions Documentation¶
function ENDSTONE_EVENT¶
function PlayerArmSwingEvent¶
inline endstone::PlayerArmSwingEvent::PlayerArmSwingEvent (
const NotNull < Player > & player,
std::optional< ItemStack > item
)
function getItem¶
Gets the item the player was holding when they swung their arm.
Returns:
the item in the player's hand, or std::nullopt if the hand was empty.
The documentation for this class was generated from the following file include/endstone/event/player/player_arm_swing_event.h