mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 19:34:09 +01:00
Add InventoryPickupItemEvent. Adds BUKKIT-3798
By: Michael Limiero <mike5713@gmail.com>
This commit is contained in:
parent
5cf4c1bb6c
commit
3f028f3d35
1 changed files with 58 additions and 0 deletions
|
@ -0,0 +1,58 @@
|
|||
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 boolean cancelled;
|
||||
private final Inventory inventory;
|
||||
private final Item item;
|
||||
|
||||
public InventoryPickupItemEvent(final Inventory inventory, final Item item) {
|
||||
super();
|
||||
this.inventory = inventory;
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue