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 import org.bukkit.util.Vector; 007 008 /** 009 * Called when the velocity of a player changes. 010 */ 011 public class PlayerVelocityEvent extends PlayerEvent implements Cancellable { 012 private static final HandlerList handlers = new HandlerList(); 013 private boolean cancel = false; 014 private Vector velocity; 015 016 public PlayerVelocityEvent(final Player player, final Vector velocity) { 017 super(player); 018 this.velocity = velocity; 019 } 020 021 public boolean isCancelled() { 022 return cancel; 023 } 024 025 public void setCancelled(boolean cancel) { 026 this.cancel = cancel; 027 } 028 029 /** 030 * Gets the velocity vector that will be sent to the player 031 * 032 * @return Vector the player will get 033 */ 034 public Vector getVelocity() { 035 return velocity; 036 } 037 038 /** 039 * Sets the velocity vector that will be sent to the player 040 * 041 * @param velocity The velocity vector that will be sent to the player 042 */ 043 public void setVelocity(Vector velocity) { 044 this.velocity = velocity; 045 } 046 047 @Override 048 public HandlerList getHandlers() { 049 return handlers; 050 } 051 052 public static HandlerList getHandlerList() { 053 return handlers; 054 } 055 }