Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
PlayerInteractEntityEvent.java
1 package org.bukkit.event.player;
2 
3 import org.bukkit.entity.Entity;
4 import org.bukkit.entity.Player;
7 
8 /**
9  * Represents an event that is called when a player right clicks an entity.
10  */
11 public class PlayerInteractEntityEvent extends PlayerEvent implements Cancellable {
12  private static final HandlerList handlers = new HandlerList();
13  protected Entity clickedEntity;
14  boolean cancelled = false;
15 
16  public PlayerInteractEntityEvent(final Player who, final Entity clickedEntity) {
17  super(who);
18  this.clickedEntity = clickedEntity;
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 entity that was rightclicked by the player.
31  *
32  * @return entity right clicked by player
33  */
35  return this.clickedEntity;
36  }
37 
38  @Override
39  public HandlerList getHandlers() {
40  return handlers;
41  }
42 
43  public static HandlerList getHandlerList() {
44  return handlers;
45  }
46 }