mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 06:30:46 +01:00
Adds PlayerArmSwingEvent
This commit is contained in:
parent
a2a581ba6b
commit
1284f0bf53
2 changed files with 30 additions and 0 deletions
|
@ -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();
|
||||||
|
|
Loading…
Reference in a new issue