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:
Bukkit/Spigot 2011-01-19 00:07:38 +08:00
parent 14009cb350
commit f0cb21dc46
4 changed files with 54 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -0,0 +1,8 @@
package org.bukkit.event.player;
/*
* Differet types of player animations
*/
public enum PlayerAnimationType {
ARM_SWING
}

View file

@ -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) {
}
}

View file

@ -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;