diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/InventoryWrapper.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/InventoryWrapper.java index 9c5ec924eb..c280dbbc82 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/InventoryWrapper.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/InventoryWrapper.java @@ -128,7 +128,7 @@ public class InventoryWrapper implements IInventory { List items = new ArrayList(size); for (int i = 0; i < size; i++) { - items.set(i, getItem(i)); + items.add(getItem(i)); } return items; diff --git a/paper-server/src/test/java/org/bukkit/craftbukkit/inventory/InventoryWrapperTest.java b/paper-server/src/test/java/org/bukkit/craftbukkit/inventory/InventoryWrapperTest.java new file mode 100644 index 0000000000..9448c18826 --- /dev/null +++ b/paper-server/src/test/java/org/bukkit/craftbukkit/inventory/InventoryWrapperTest.java @@ -0,0 +1,23 @@ +package org.bukkit.craftbukkit.inventory; + +import junit.framework.Assert; +import org.bukkit.Material; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; +import org.junit.Test; + +public class InventoryWrapperTest { + + @Test + public void test() { + Inventory raw = new CraftInventoryCustom(null, 9); + raw.addItem(new ItemStack(Material.STONE)); + + Assert.assertTrue(raw.contains(Material.STONE)); + + InventoryWrapper wrapper = new InventoryWrapper(raw); + CraftInventory proxy = new CraftInventory(wrapper); + + Assert.assertTrue(proxy.contains(Material.STONE)); + } +}