Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package org.bukkit.event.player;
2
3import org.bukkit.entity.Player;
4import org.bukkit.event.Cancellable;
5import org.bukkit.event.Event;
6import org.bukkit.util.Vector;
7
8public class PlayerVelocityEvent extends PlayerEvent implements Cancellable {
9
10 /**
11 * Holds information for player velocity events
12 */
13 private boolean cancel = false;
14 private Vector velocity;
15
16 public PlayerVelocityEvent(final Player player, final Vector velocity) {
17 super(Type.PLAYER_VELOCITY, player);
18 this.velocity = velocity;
19 }
20
21 PlayerVelocityEvent(final Event.Type type, final Player player, final Vector velocity) {
22 super(type, player);
23 this.velocity = velocity;
24 }
25
26 /**
27 * Gets the cancellation state of this event. A cancelled event will not
28 * be executed in the server, but will still pass to other plugins
29 *
30 * @return true if this event is cancelled
31 */
32 public boolean isCancelled() {
33 return cancel;
34 }
35
36 /**
37 * Sets the cancellation state of this event. A cancelled event will not
38 * be executed in the server, but will still pass to other plugins
39 *
40 * @param cancel true if you wish to cancel this event
41 */
42 public void setCancelled(boolean cancel) {
43 this.cancel = cancel;
44 }
45
46 /**
47 * Gets the velocity vector that will be sent to the player
48 *
49 * @return Vector the player will get
50 */
51 public Vector getVelocity() {
52 return velocity;
53 }
54
55 /**
56 * Sets the velocity vector that will be sent to the player
57 *
58 * @param velocity The velocity vector that will be sent to the player
59 */
60 public void setVelocity(Vector velocity) {
61 this.velocity = velocity;
62 }
63}