
org.bukkit.event.entity.ItemDespawnEvent Maven / Gradle / Ivy
package org.bukkit.event.entity;
import org.bukkit.Location;
import org.bukkit.entity.Item;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/**
* This event is called when a {@link org.bukkit.entity.Item} is removed from
* the world because it has existed for 5 minutes.
*
* Cancelling the event results in the item being allowed to exist for 5 more
* minutes. This behavior is not guaranteed and may change in future versions.
*/
public class ItemDespawnEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final Location location;
private boolean canceled;
public ItemDespawnEvent(final Item despawnee, final Location loc) {
super(despawnee);
location = loc;
}
public static HandlerList getHandlerList() {
return handlers;
}
public boolean isCancelled() {
return canceled;
}
public void setCancelled(boolean cancel) {
canceled = cancel;
}
@Override
public Item getEntity() {
return (Item) entity;
}
/**
* Gets the location at which the item is despawning.
*
* @return The location at which the item is despawning
*/
public Location getLocation() {
return location;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
}