From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Fri, 12 Mar 2021 19:20:03 -0800 Subject: [PATCH] Adds PlayerArmSwingEvent diff --git a/src/main/java/io/papermc/paper/event/player/PlayerArmSwingEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerArmSwingEvent.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 --- /dev/null +++ b/src/main/java/io/papermc/paper/event/player/PlayerArmSwingEvent.java @@ -0,0 +0,0 @@ +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.NotNull; + +public class PlayerArmSwingEvent extends PlayerAnimationEvent { + + private final EquipmentSlot equipmentSlot; + + public PlayerArmSwingEvent(@NotNull Player player, @NotNull 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 + */ + @NotNull + public EquipmentSlot getHand() { + return this.equipmentSlot; + } +} diff --git a/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java b/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java @@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; /** * Represents a player animation event + *
Use {@link io.papermc.paper.event.player.PlayerArmSwingEvent} for determining which arm was swung. */ public class PlayerAnimationEvent extends PlayerEvent implements Cancellable { private static final HandlerList handlers = new HandlerList();