mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2025-02-25 14:21:51 +01:00
Yeah, kind of screwed that before :P
This commit is contained in:
parent
ac7a14cab8
commit
a5728dc2d0
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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/
|
||||||
|
Loading…
Reference in New Issue
Block a user