Yeah, kind of screwed that before :P

This commit is contained in:
Acrobot 2012-11-30 21:50:03 +01:00
parent ac7a14cab8
commit a5728dc2d0
3 changed files with 7 additions and 3 deletions

View File

@ -85,13 +85,17 @@ public class InventoryUtil {
public static boolean fits(ItemStack item, Inventory inventory) { public static boolean fits(ItemStack item, Inventory inventory) {
int left = item.getAmount(); int left = item.getAmount();
if (inventory.getMaxStackSize() == Integer.MAX_VALUE) {
return true;
}
for (ItemStack iStack : inventory.getContents()) { for (ItemStack iStack : inventory.getContents()) {
if (left <= 0) { if (left <= 0) {
return true; return true;
} }
if (MaterialUtil.isEmpty(iStack)) { if (MaterialUtil.isEmpty(iStack)) {
left -= inventory.getMaxStackSize(); left -= item.getMaxStackSize();
continue; continue;
} }

View File

@ -46,7 +46,7 @@ public class ItemManager implements Listener {
private static void addItems(Inventory inventory, ItemStack[] items) { private static void addItems(Inventory inventory, ItemStack[] items) {
for (ItemStack item : items) { for (ItemStack item : items) {
inventory.addItem(item.clone()); InventoryUtil.add(item, inventory);
} }
} }
} }

View File

@ -2,7 +2,7 @@ name: ChestShop
main: com.Acrobot.ChestShop.ChestShop main: com.Acrobot.ChestShop.ChestShop
version: 3.50t0034 version: 3.50t0035
#for CButD #for CButD
dev-url: http://dev.bukkit.org/server-mods/chestshop/ dev-url: http://dev.bukkit.org/server-mods/chestshop/