From 86b97ec79e54820019a32e0661a54712e05ee9bd Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Tue, 13 Mar 2012 22:28:07 -0400 Subject: [PATCH] [Bleeding] Make InventoryView.setItem(-999, item) drop the item on the ground by default. By: Celtic Minstrel --- .../src/main/java/org/bukkit/inventory/InventoryView.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/paper-api/src/main/java/org/bukkit/inventory/InventoryView.java b/paper-api/src/main/java/org/bukkit/inventory/InventoryView.java index fd2c40809..84e189ed5 100644 --- a/paper-api/src/main/java/org/bukkit/inventory/InventoryView.java +++ b/paper-api/src/main/java/org/bukkit/inventory/InventoryView.java @@ -88,6 +88,9 @@ public abstract class InventoryView { /** * Sets one item in this inventory view by its raw slot ID. + *

+ * Note: If slot ID -999 is chosen, it may be expected that the item is + * dropped on the ground. This is not required behaviour, however. * @param slot The ID as returned by InventoryClickEvent.getRawSlot() * @param item The new item to put in the slot, or null to clear it. */ @@ -98,6 +101,8 @@ public abstract class InventoryView { } else { getBottomInventory().setItem(convertSlot(slot),item); } + } else { + getPlayer().getWorld().dropItemNaturally(getPlayer().getLocation(), item); } }