mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00: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
64eda9b295
commit
2ca88187c4
1 changed files with 4 additions and 3 deletions
|
@ -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…
Reference in a new issue