Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
PlayerToggleSprintEvent.java
1 package org.bukkit.event.player;
2 
3 import org.bukkit.entity.Player;
6 
7 /**
8  * Called when a player toggles their sprinting state
9  */
10 public class PlayerToggleSprintEvent extends PlayerEvent implements Cancellable {
11  private static final HandlerList handlers = new HandlerList();
12  private final boolean isSprinting;
13  private boolean cancel = false;
14 
15  public PlayerToggleSprintEvent(final Player player, final boolean isSprinting) {
16  super(player);
17  this.isSprinting = isSprinting;
18  }
19 
20  /**
21  * Gets whether the player is now sprinting or not.
22  *
23  * @return sprinting state
24  */
25  public boolean isSprinting() {
26  return isSprinting;
27  }
28 
29  public boolean isCancelled() {
30  return cancel;
31  }
32 
33  public void setCancelled(boolean cancel) {
34  this.cancel = cancel;
35  }
36 
37  @Override
38  public HandlerList getHandlers() {
39  return handlers;
40  }
41 
42  public static HandlerList getHandlerList() {
43  return handlers;
44  }
45 }