mirror of
https://github.com/essentials/Essentials.git
synced 2025-02-25 08:52:40 +01:00
Workaround for bukkit bug again.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1525 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
parent
702bf14df7
commit
bcbfee3dde
@ -173,11 +173,12 @@ public class InventoryWorkaround
|
|||||||
|
|
||||||
public static Item[] dropItem(Location loc, ItemStack itm)
|
public static Item[] dropItem(Location loc, ItemStack itm)
|
||||||
{
|
{
|
||||||
int stacks = itm.getAmount() / itm.getMaxStackSize();
|
int maxStackSize = itm.getType().getMaxStackSize();
|
||||||
int leftover = itm.getAmount() % itm.getMaxStackSize();
|
int stacks = itm.getAmount() / maxStackSize;
|
||||||
|
int leftover = itm.getAmount() % maxStackSize;
|
||||||
Item[] itemStacks = new Item[stacks + (leftover > 0 ? 1 : 0)];
|
Item[] itemStacks = new Item[stacks + (leftover > 0 ? 1 : 0)];
|
||||||
for (int i = 0; i < stacks; i++) {
|
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) {
|
if (leftover > 0) {
|
||||||
itemStacks[stacks] = loc.getWorld().dropItem(loc, new ItemStack(itm.getType(), leftover, itm.getDurability()));
|
itemStacks[stacks] = loc.getWorld().dropItem(loc, new ItemStack(itm.getType(), leftover, itm.getDurability()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user