Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
PlayerToggleFlightEvent.java
1 package org.bukkit.event.player;
2 
3 import org.bukkit.entity.Player;
6 
7 /**
8  * Called when a player toggles their flying state
9  */
10 public class PlayerToggleFlightEvent extends PlayerEvent implements Cancellable {
11  private static final HandlerList handlers = new HandlerList();
12  private final boolean isFlying;
13  private boolean cancel = false;
14 
15  public PlayerToggleFlightEvent(final Player player, final boolean isFlying) {
16  super(player);
17  this.isFlying = isFlying;
18  }
19 
20  /**
21  * Returns whether the player is trying to start or stop flying.
22  *
23  * @return flying state
24  */
25  public boolean isFlying() {
26  return isFlying;
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 }