Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
EntityTeleportEvent.java
1 package org.bukkit.event.entity;
2 
3 import org.bukkit.Location;
4 import org.bukkit.entity.Entity;
7 
8 /**
9  * Thrown when a non-player entity (such as an Enderman) tries to teleport
10  * from one location to another.
11  */
12 public class EntityTeleportEvent extends EntityEvent implements Cancellable {
13  private static final HandlerList handlers = new HandlerList();
14  private boolean cancel;
15  private Location from;
16  private Location to;
17 
18  public EntityTeleportEvent(Entity what, Location from, Location to) {
19  super(what);
20  this.from = from;
21  this.to = to;
22  this.cancel = false;
23  }
24 
25  public boolean isCancelled() {
26  return cancel;
27  }
28 
29  public void setCancelled(boolean cancel) {
30  this.cancel = cancel;
31  }
32 
33  /**
34  * Gets the location that this entity moved from
35  *
36  * @return Location this entity moved from
37  */
38  public Location getFrom() {
39  return from;
40  }
41 
42  /**
43  * Sets the location that this entity moved from
44  *
45  * @param from New location this entity moved from
46  */
47  public void setFrom(Location from) {
48  this.from = from;
49  }
50 
51  /**
52  * Gets the location that this entity moved to
53  *
54  * @return Location the entity moved to
55  */
56  public Location getTo() {
57  return to;
58  }
59 
60  /**
61  * Sets the location that this entity moved to
62  *
63  * @param to New Location this entity moved to
64  */
65  public void setTo(Location to) {
66  this.to = to;
67  }
68 
69  @Override
70  public HandlerList getHandlers() {
71  return handlers;
72  }
73 
74  public static HandlerList getHandlerList() {
75  return handlers;
76  }
77 }