001 package org.bukkit.event.inventory; 002 003 import org.bukkit.entity.Item; 004 import org.bukkit.event.Cancellable; 005 import org.bukkit.event.Event; 006 import org.bukkit.event.HandlerList; 007 import org.bukkit.inventory.Inventory; 008 009 /** 010 * Called when a hopper or hopper minecart picks up a dropped item. 011 */ 012 public class InventoryPickupItemEvent extends Event implements Cancellable { 013 private static final HandlerList handlers = new HandlerList(); 014 private boolean cancelled; 015 private final Inventory inventory; 016 private final Item item; 017 018 public InventoryPickupItemEvent(final Inventory inventory, final Item item) { 019 super(); 020 this.inventory = inventory; 021 this.item = item; 022 } 023 024 /** 025 * Gets the Inventory that picked up the item 026 * 027 * @return Inventory 028 */ 029 public Inventory getInventory() { 030 return inventory; 031 } 032 033 /** 034 * Gets the Item entity that was picked up 035 * 036 * @return Item 037 */ 038 public Item getItem() { 039 return item; 040 } 041 042 public boolean isCancelled() { 043 return cancelled; 044 } 045 046 public void setCancelled(boolean cancel) { 047 this.cancelled = cancel; 048 } 049 050 @Override 051 public HandlerList getHandlers() { 052 return handlers; 053 } 054 055 public static HandlerList getHandlerList() { 056 return handlers; 057 } 058 }