Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
PlayerGameModeChangeEvent.java
1 package org.bukkit.event.player;
2 
3 import org.bukkit.GameMode;
4 import org.bukkit.entity.Player;
7 
8 /**
9  * Called when the GameMode of the player is changed.
10  */
11 public class PlayerGameModeChangeEvent extends PlayerEvent implements Cancellable {
12  private static final HandlerList handlers = new HandlerList();
13  private boolean cancelled;
14  private final GameMode newGameMode;
15 
16  public PlayerGameModeChangeEvent(final Player player, final GameMode newGameMode) {
17  super(player);
18  this.newGameMode = newGameMode;
19  }
20 
21  public boolean isCancelled() {
22  return cancelled;
23  }
24 
25  public void setCancelled(boolean cancel) {
26  this.cancelled = cancel;
27  }
28 
29  /**
30  * Gets the GameMode the player is switched to.
31  *
32  * @return player's new GameMode
33  */
35  return newGameMode;
36  }
37 
38  @Override
39  public HandlerList getHandlers() {
40  return handlers;
41  }
42 
43  public static HandlerList getHandlerList() {
44  return handlers;
45  }
46 }