Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
PlayerLeashEntityEvent.java
1 package org.bukkit.event.entity;
2 
3 import org.bukkit.entity.Entity;
4 import org.bukkit.entity.Player;
6 import org.bukkit.event.Event;
8 
9 /**
10  * Called immediately prior to a creature being leashed by a player.
11  */
12 public class PlayerLeashEntityEvent extends Event implements Cancellable {
13  private static final HandlerList handlers = new HandlerList();
14  private final Entity leashHolder;
15  private final Entity entity;
16  private boolean cancelled = false;
17  private final Player player;
18 
19  public PlayerLeashEntityEvent(Entity what, Entity leashHolder, Player leasher) {
20  this.leashHolder = leashHolder;
21  this.entity = what;
22  this.player = leasher;
23  }
24 
25  /**
26  * Returns the entity that is holding the leash.
27  *
28  * @return The leash holder
29  */
31  return leashHolder;
32  }
33 
34  /**
35  * Returns the entity being leashed.
36  *
37  * @return The entity
38  */
39  public Entity getEntity() {
40  return entity;
41  }
42 
43  /**
44  * Returns the player involved in this event
45  *
46  * @return Player who is involved in this event
47  */
48  public final Player getPlayer() {
49  return player;
50  }
51 
52  @Override
53  public HandlerList getHandlers() {
54  return handlers;
55  }
56 
57  public static HandlerList getHandlerList() {
58  return handlers;
59  }
60 
61  public boolean isCancelled() {
62  return this.cancelled;
63  }
64 
65  public void setCancelled(boolean cancel) {
66  this.cancelled = cancel;
67  }
68 }