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