001    package org.bukkit.event.player;
002    
003    import org.bukkit.entity.Player;
004    import org.bukkit.event.Cancellable;
005    import org.bukkit.event.HandlerList;
006    
007    /**
008     * Represents a player animation event
009     */
010    public class PlayerAnimationEvent extends PlayerEvent implements Cancellable {
011        private static final HandlerList handlers = new HandlerList();
012        private final PlayerAnimationType animationType;
013        private boolean isCancelled = false;
014    
015        /**
016         * Construct a new PlayerAnimation event
017         *
018         * @param player The player instance
019         */
020        public PlayerAnimationEvent(final Player player) {
021            super(player);
022    
023            // Only supported animation type for now:
024            animationType = PlayerAnimationType.ARM_SWING;
025        }
026    
027        /**
028         * Get the type of this animation event
029         *
030         * @return the animation type
031         */
032        public PlayerAnimationType getAnimationType() {
033            return animationType;
034        }
035    
036        public boolean isCancelled() {
037            return this.isCancelled;
038        }
039    
040        public void setCancelled(boolean cancel) {
041            this.isCancelled = cancel;
042        }
043    
044        @Override
045        public HandlerList getHandlers() {
046            return handlers;
047        }
048    
049        public static HandlerList getHandlerList() {
050            return handlers;
051        }
052    }