Don't drop oversized stacks on the ground if player doesn't have oversized permission.

This commit is contained in:
KHobbits 2013-06-26 21:44:34 +01:00
parent 18d0183364
commit 3e519f95d5

View File

@ -194,7 +194,8 @@ public class Kit
} }
final Map<Integer, ItemStack> overfilled; final Map<Integer, ItemStack> overfilled;
if (user.isAuthorized("essentials.oversizedstacks")) final boolean allowOversizedStacks = user.isAuthorized("essentials.oversizedstacks");
if (allowOversizedStacks)
{ {
overfilled = InventoryWorkaround.addOversizedItems(user.getInventory(), ess.getSettings().getOversizedStackSize(), metaStack.getItemStack()); overfilled = InventoryWorkaround.addOversizedItems(user.getInventory(), ess.getSettings().getOversizedStackSize(), metaStack.getItemStack());
} }
@ -204,7 +205,14 @@ public class Kit
} }
for (ItemStack itemStack : overfilled.values()) for (ItemStack itemStack : overfilled.values())
{ {
user.getWorld().dropItemNaturally(user.getLocation(), itemStack); int spillAmount = itemStack.getAmount();
if (!allowOversizedStacks) {
itemStack.setAmount(spillAmount < itemStack.getMaxStackSize() ? spillAmount : itemStack.getMaxStackSize());
}
while (spillAmount > 0) {
user.getWorld().dropItemNaturally(user.getLocation(), itemStack);
spillAmount -= itemStack.getAmount();
}
spew = true; spew = true;
} }
} }