summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-05-22 21:29:04 +0000
committersnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-05-22 21:29:04 +0000
commit2ca88187c446efcd11264e666e4037ed5989d0fb (patch)
treea5723a0466fe53ab891e57b861e3f45b6f35701b
parent64eda9b295af8ac19bb1c4d089c294924c793765 (diff)
downloadEssentials-2ca88187c446efcd11264e666e4037ed5989d0fb.tar
Essentials-2ca88187c446efcd11264e666e4037ed5989d0fb.tar.gz
Essentials-2ca88187c446efcd11264e666e4037ed5989d0fb.tar.lz
Essentials-2ca88187c446efcd11264e666e4037ed5989d0fb.tar.xz
Essentials-2ca88187c446efcd11264e666e4037ed5989d0fb.zip
Workaround for bukkit bug again.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1525 e251c2fe-e539-e718-e476-b85c1f46cddb
-rw-r--r--Essentials/src/com/earth2me/essentials/InventoryWorkaround.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java b/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java
index 73f2711d9..2a5b8ce75 100644
--- a/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java
+++ b/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java
@@ -173,11 +173,12 @@ public class InventoryWorkaround
public static Item[] dropItem(Location loc, ItemStack itm)
{
- int stacks = itm.getAmount() / itm.getMaxStackSize();
- int leftover = itm.getAmount() % itm.getMaxStackSize();
+ int maxStackSize = itm.getType().getMaxStackSize();
+ int stacks = itm.getAmount() / maxStackSize;
+ int leftover = itm.getAmount() % maxStackSize;
Item[] itemStacks = new Item[stacks + (leftover > 0 ? 1 : 0)];
for (int i = 0; i < stacks; i++) {
- itemStacks[i] = loc.getWorld().dropItem(loc, new ItemStack(itm.getType(), itm.getMaxStackSize(), itm.getDurability()));
+ itemStacks[i] = loc.getWorld().dropItem(loc, new ItemStack(itm.getType(), maxStackSize, itm.getDurability()));
}
if (leftover > 0) {
itemStacks[stacks] = loc.getWorld().dropItem(loc, new ItemStack(itm.getType(), leftover, itm.getDurability()));