PlayerHandSwingEvent¶
Triggered when a player swings their hand.
A left click swings the main hand. A right click that does something with the item in a hand swings that hand: placing a block, feeding an animal, and so on. This is how the off hand swings, for example when a player whose main hand holds nothing to place places the torch in their off hand. Starting to eat or to draw a bow doesn't swing.
This event cannot be canceled. It may fire repeatedly while the player holds down the mouse button.
Example
local queue = spell:collect("PlayerHandSwingEvent")
while true do
local evt = queue:next()
spell:execute("playsound minecraft:block.amethyst_block.break player @a ~ ~ ~ 100 1")
end
Fields¶
hand: Hand — Read-Only¶
The hand used to perform the swing.
name: string — Read-Only¶
The name of the event.
player: Player — Read-Only¶
A reference to the player who triggered the hand swing event.