mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-21 05:55:08 +01:00
53 lines
2.2 KiB
Diff
53 lines
2.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
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..84dfb8da90c5f21d0f8899eca57bcb8b58614ca9
|
|
--- /dev/null
|
|
+++ b/src/main/java/io/papermc/paper/event/player/PlayerArmSwingEvent.java
|
|
@@ -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;
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java b/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java
|
|
index 1f2d3b3e9748eec04b5514376599c9233f65b736..0c7e3a0c4d77a8e11f96b9c498dbf2917ad2d981 100644
|
|
--- a/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java
|
|
+++ b/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java
|
|
@@ -7,6 +7,7 @@ import org.jetbrains.annotations.NotNull;
|
|
|
|
/**
|
|
* 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 {
|
|
private static final HandlerList handlers = new HandlerList();
|