All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bukkit.event.inventory.InventoryPickupItemEvent Maven / Gradle / Ivy

package org.bukkit.event.inventory;

import org.bukkit.entity.Item;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.Inventory;

/**
 * Called when a hopper or hopper minecart picks up a dropped item.
 */
public class InventoryPickupItemEvent extends Event implements Cancellable {
  private static final HandlerList handlers = new HandlerList();
  private final Inventory inventory;
  private final Item item;
  private boolean cancelled;

  public InventoryPickupItemEvent(final Inventory inventory, final Item item) {
    super();
    this.inventory = inventory;
    this.item = item;
  }

  public static HandlerList getHandlerList() {
    return handlers;
  }

  /**
   * Gets the Inventory that picked up the item
   *
   * @return Inventory
   */
  public Inventory getInventory() {
    return inventory;
  }

  /**
   * Gets the Item entity that was picked up
   *
   * @return Item
   */
  public Item getItem() {
    return item;
  }

  public boolean isCancelled() {
    return cancelled;
  }

  public void setCancelled(boolean cancel) {
    this.cancelled = cancel;
  }

  @Override
  public HandlerList getHandlers() {
    return handlers;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy