Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
PlayerTeleportEvent.java
1 package org.bukkit.event.player;
2 
3 import org.bukkit.Location;
4 import org.bukkit.entity.Player;
6 
7 /**
8  * Holds information for player teleport events
9  */
10 public class PlayerTeleportEvent extends PlayerMoveEvent {
11  private static final HandlerList handlers = new HandlerList();
12  private TeleportCause cause = TeleportCause.UNKNOWN;
13 
14  public PlayerTeleportEvent(final Player player, final Location from, final Location to) {
15  super(player, from, to);
16  }
17 
18  public PlayerTeleportEvent(final Player player, final Location from, final Location to, final TeleportCause cause) {
19  this(player, from, to);
20 
21  this.cause = cause;
22  }
23 
24  /**
25  * Gets the cause of this teleportation event
26  *
27  * @return Cause of the event
28  */
30  return cause;
31  }
32 
33  public enum TeleportCause {
34  /**
35  * Indicates the teleporation was caused by a player throwing an Ender
36  * Pearl
37  */
39  /**
40  * Indicates the teleportation was caused by a player executing a
41  * command
42  */
44  /**
45  * Indicates the teleportation was caused by a plugin
46  */
48  /**
49  * Indicates the teleportation was caused by a player entering a
50  * Nether portal
51  */
53  /**
54  * Indicates the teleportation was caused by a player entering an End
55  * portal
56  */
58  /**
59  * Indicates the teleportation was caused by an event not covered by
60  * this enum
61  */
63  }
64 
65  @Override
66  public HandlerList getHandlers() {
67  return handlers;
68  }
69 
70  public static HandlerList getHandlerList() {
71  return handlers;
72  }
73 }