001 package org.bukkit.event.player;
002
003 import org.bukkit.entity.Item;
004 import org.bukkit.entity.Player;
005 import org.bukkit.event.Cancellable;
006 import org.bukkit.event.HandlerList;
007
008 /**
009 * Thrown when a player drops an item from their inventory
010 */
011 public class PlayerDropItemEvent extends PlayerEvent implements Cancellable {
012 private static final HandlerList handlers = new HandlerList();
013 private final Item drop;
014 private boolean cancel = false;
015
016 public PlayerDropItemEvent(final Player player, final Item drop) {
017 super(player);
018 this.drop = drop;
019 }
020
021 /**
022 * Gets the ItemDrop created by the player
023 *
024 * @return ItemDrop created by the player
025 */
026 public Item getItemDrop() {
027 return drop;
028 }
029
030 public boolean isCancelled() {
031 return cancel;
032 }
033
034 public void setCancelled(boolean cancel) {
035 this.cancel = cancel;
036 }
037
038 @Override
039 public HandlerList getHandlers() {
040 return handlers;
041 }
042
043 public static HandlerList getHandlerList() {
044 return handlers;
045 }
046 }