mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-31 20:22:05 -07:00
Adds PlayerArmSwingEvent
This commit is contained in:
@@ -0,0 +1,29 @@
|
|||||||
|
package io.papermc.paper.event.player;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||||
|
import org.bukkit.event.player.PlayerAnimationType;
|
||||||
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
|
import org.jspecify.annotations.NullMarked;
|
||||||
|
|
||||||
|
@NullMarked
|
||||||
|
public class PlayerArmSwingEvent extends PlayerAnimationEvent {
|
||||||
|
|
||||||
|
private final EquipmentSlot equipmentSlot;
|
||||||
|
|
||||||
|
@ApiStatus.Internal
|
||||||
|
public PlayerArmSwingEvent(final Player player, final EquipmentSlot equipmentSlot) {
|
||||||
|
super(player, equipmentSlot == EquipmentSlot.HAND ? PlayerAnimationType.ARM_SWING : PlayerAnimationType.OFF_ARM_SWING);
|
||||||
|
this.equipmentSlot = equipmentSlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the hand of the arm swing.
|
||||||
|
*
|
||||||
|
* @return the hand
|
||||||
|
*/
|
||||||
|
public EquipmentSlot getHand() {
|
||||||
|
return this.equipmentSlot;
|
||||||
|
}
|
||||||
|
}
|
@@ -7,6 +7,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a player animation event
|
* Represents a player animation event
|
||||||
|
* <br>Use {@link io.papermc.paper.event.player.PlayerArmSwingEvent} for determining which arm was swung.
|
||||||
*/
|
*/
|
||||||
public class PlayerAnimationEvent extends PlayerEvent implements Cancellable {
|
public class PlayerAnimationEvent extends PlayerEvent implements Cancellable {
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
Reference in New Issue
Block a user