mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 03:25:15 +01:00
Implement InventoryPickupItemEvent. Adds BUKKIT-3798
This commit is contained in:
parent
2642fbdf7e
commit
2e6cfdb3cc
@ -5,6 +5,7 @@ import java.util.List;
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
|
import org.bukkit.event.inventory.InventoryPickupItemEvent;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public class TileEntityHopper extends TileEntity implements IHopper {
|
public class TileEntityHopper extends TileEntity implements IHopper {
|
||||||
@ -261,6 +262,14 @@ public class TileEntityHopper extends TileEntity implements IHopper {
|
|||||||
if (entityitem == null) {
|
if (entityitem == null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
// CraftBukkit start
|
||||||
|
InventoryPickupItemEvent event = new InventoryPickupItemEvent(iinventory.getOwner().getInventory(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||||
|
entityitem.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
ItemStack itemstack = entityitem.getItemStack().cloneItemStack();
|
ItemStack itemstack = entityitem.getItemStack().cloneItemStack();
|
||||||
ItemStack itemstack1 = a(iinventory, itemstack, -1);
|
ItemStack itemstack1 = a(iinventory, itemstack, -1);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user