Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
InventoryOpenEvent.java
1 package org.bukkit.event.inventory;
2 
7 
8 /**
9  * Represents a player related inventory event
10  */
11 public class InventoryOpenEvent extends InventoryEvent implements Cancellable {
12  private static final HandlerList handlers = new HandlerList();
13  private boolean cancelled;
14 
15  public InventoryOpenEvent(InventoryView transaction) {
16  super(transaction);
17  this.cancelled = false;
18  }
19 
20  /**
21  * Returns the player involved in this event
22  *
23  * @return Player who is involved in this event
24  */
25  public final HumanEntity getPlayer() {
26  return transaction.getPlayer();
27  }
28 
29  /**
30  * Gets the cancellation state of this event. A cancelled event will not
31  * be executed in the server, but will still pass to other plugins.
32  * <p>
33  * If an inventory open event is cancelled, the inventory screen will not
34  * show.
35  *
36  * @return true if this event is cancelled
37  */
38  public boolean isCancelled() {
39  return cancelled;
40  }
41 
42  /**
43  * Sets the cancellation state of this event. A cancelled event will not
44  * be executed in the server, but will still pass to other plugins.
45  * <p>
46  * If an inventory open event is cancelled, the inventory screen will not
47  * show.
48  *
49  * @param cancel true if you wish to cancel this event
50  */
51  public void setCancelled(boolean cancel) {
52  cancelled = cancel;
53  }
54 
55  @Override
56  public HandlerList getHandlers() {
57  return handlers;
58  }
59 
60  public static HandlerList getHandlerList() {
61  return handlers;
62  }
63 }
abstract HumanEntity getPlayer()