Use Bukkit's addItem method if maxStackSize equals the item's natural stack size

This commit is contained in:
Phoenix616 2017-02-19 17:17:42 +01:00
parent 90f7dd5b0f
commit 765548e0e5

View File

@ -137,6 +137,10 @@ public class InventoryUtil {
return 0;
}
if (maxStackSize == item.getMaxStackSize()) {
return add(item, inventory);
}
int amountLeft = item.getAmount();
for (int currentSlot = 0; currentSlot < effectiveSize(inventory) && amountLeft > 0; currentSlot++) {