mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Address Feature#105:Implement support for PLAYER_ANIMATION hook/event.
Requires corresponding CraftBukkit change. NOTE: The email address of this commit used to be: "Nathan Wolf < <nteske@gmail.com>" This has been fixed but will cause all commits after to change. By: Nathan Wolf <nteske@gmail.com>
This commit is contained in:
parent
14009cb350
commit
f0cb21dc46
4 changed files with 54 additions and 0 deletions
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package org.bukkit.event.player;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Differet types of player animations
|
||||||
|
*/
|
||||||
|
public enum PlayerAnimationType {
|
||||||
|
ARM_SWING
|
||||||
|
}
|
|
@ -81,4 +81,12 @@ public class PlayerListener implements Listener {
|
||||||
*/
|
*/
|
||||||
public void onPlayerEggThrow(PlayerEggThrowEvent event) {
|
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) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,6 +152,9 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||||
case PLAYER_EGG_THROW:
|
case PLAYER_EGG_THROW:
|
||||||
trueListener.onPlayerEggThrow((PlayerEggThrowEvent)event);
|
trueListener.onPlayerEggThrow((PlayerEggThrowEvent)event);
|
||||||
break;
|
break;
|
||||||
|
case PLAYER_ANIMATION:
|
||||||
|
trueListener.onPlayerAnimation((PlayerAnimationEvent)event);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else if (listener instanceof BlockListener) {
|
} else if (listener instanceof BlockListener) {
|
||||||
BlockListener trueListener = (BlockListener)listener;
|
BlockListener trueListener = (BlockListener)listener;
|
||||||
|
|
Loading…
Reference in a new issue