diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java new file mode 100644 index 0000000000..1d860d3942 --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java @@ -0,0 +1,35 @@ +package org.bukkit.event.player; + +import org.bukkit.entity.Player; + +/* + * Represents a player animation event + */ +public class PlayerAnimationEvent extends PlayerEvent { + + private PlayerAnimationType animationType; + + /* + * Construct a new event + * + * @param type The event type + * @param player The player instance + */ + public PlayerAnimationEvent(final Type type, final Player player) { + super(type, player); + + // Only supported animation type for now: + animationType = PlayerAnimationType.ARM_SWING; + } + + /* + * Get the type of this animation event + * + * @returns the animation type + */ + public PlayerAnimationType getAnimationType() + { + return animationType; + } + +} diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerAnimationType.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerAnimationType.java new file mode 100644 index 0000000000..5f2d7bcd4d --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerAnimationType.java @@ -0,0 +1,8 @@ +package org.bukkit.event.player; + +/* + * Differet types of player animations + */ +public enum PlayerAnimationType { + ARM_SWING +} diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerListener.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerListener.java index 08a590164d..2739f6fd76 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerListener.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerListener.java @@ -81,4 +81,12 @@ public class PlayerListener implements Listener { */ public void onPlayerEggThrow(PlayerEggThrowEvent event) { } + + /** + * Called when a player plays an animation, such as an arm swing + * + * @param event Relevant event details + */ + public void onPlayerAnimation(PlayerAnimationEvent event) { + } } diff --git a/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java index 99102fb950..3886027a2f 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -152,6 +152,9 @@ public final class JavaPluginLoader implements PluginLoader { case PLAYER_EGG_THROW: trueListener.onPlayerEggThrow((PlayerEggThrowEvent)event); break; + case PLAYER_ANIMATION: + trueListener.onPlayerAnimation((PlayerAnimationEvent)event); + break; } } else if (listener instanceof BlockListener) { BlockListener trueListener = (BlockListener)listener;