Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
PlayerPickupItemEvent.java
1 package org.bukkit.event.player;
2 
3 import org.bukkit.entity.Item;
4 import org.bukkit.entity.Player;
7 
8 /**
9  * Thrown when a player picks an item up from the ground
10  */
11 public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
12  private static final HandlerList handlers = new HandlerList();
13  private final Item item;
14  private boolean cancel = false;
15  private final int remaining;
16 
17  public PlayerPickupItemEvent(final Player player, final Item item, final int remaining) {
18  super(player);
19  this.item = item;
20  this.remaining = remaining;
21  }
22 
23  /**
24  * Gets the Item picked up by the player.
25  *
26  * @return Item
27  */
28  public Item getItem() {
29  return item;
30  }
31 
32  /**
33  * Gets the amount remaining on the ground, if any
34  *
35  * @return amount remaining on the ground
36  */
37  public int getRemaining() {
38  return remaining;
39  }
40 
41  public boolean isCancelled() {
42  return cancel;
43  }
44 
45  public void setCancelled(boolean cancel) {
46  this.cancel = cancel;
47  }
48 
49  @Override
50  public HandlerList getHandlers() {
51  return handlers;
52  }
53 
54  public static HandlerList getHandlerList() {
55  return handlers;
56  }
57 }