Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
ItemDespawnEvent.java
1 package org.bukkit.event.entity;
2 
3 import org.bukkit.Location;
4 import org.bukkit.entity.Item;
7 
8 /**
9  * This event is called when a {@link org.bukkit.entity.Item} is removed from
10  * the world because it has existed for 5 minutes.
11  * <p>
12  * Cancelling the event results in the item being allowed to exist for 5 more
13  * minutes. This behavior is not guaranteed and may change in future versions.
14  */
15 public class ItemDespawnEvent extends EntityEvent implements Cancellable {
16  private static final HandlerList handlers = new HandlerList();
17  private boolean canceled;
18  private final Location location;
19 
20  public ItemDespawnEvent(final Item despawnee, final Location loc) {
21  super(despawnee);
22  location = loc;
23  }
24 
25  public boolean isCancelled() {
26  return canceled;
27  }
28 
29  public void setCancelled(boolean cancel) {
30  canceled = cancel;
31  }
32 
33  @Override
34  public Item getEntity() {
35  return (Item) entity;
36  }
37 
38  /**
39  * Gets the location at which the item is despawning.
40  *
41  * @return The location at which the item is despawning
42  */
43  public Location getLocation() {
44  return location;
45  }
46 
47  @Override
48  public HandlerList getHandlers() {
49  return handlers;
50  }
51 
52  public static HandlerList getHandlerList() {
53  return handlers;
54  }
55 }