geforkt von Mirrors/Paper
SPIGOT-4646: Test + fix InventoryWrapper.getContents
By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
Ursprung
a257532ba2
Commit
6846b3d2d9
@ -128,7 +128,7 @@ public class InventoryWrapper implements IInventory {
|
|||||||
List<ItemStack> items = new ArrayList<ItemStack>(size);
|
List<ItemStack> items = new ArrayList<ItemStack>(size);
|
||||||
|
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
items.set(i, getItem(i));
|
items.add(getItem(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
|
@ -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));
|
||||||
|
}
|
||||||
|
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren