mirror of
https://github.com/essentials/Essentials.git
synced 2025-02-25 08:52:40 +01:00
Ignore defaultstacksize from config, just use 64
This commit is contained in:
parent
32b48f0f3d
commit
930f517fee
@ -81,10 +81,10 @@ public final class InventoryWorkaround
|
||||
|
||||
public static Map<Integer, ItemStack> addItem(final Inventory cinventory, final boolean forceDurability, final ItemStack... items)
|
||||
{
|
||||
return addItem(cinventory, forceDurability, false, null, items);
|
||||
return addItem(cinventory, forceDurability, false, items);
|
||||
}
|
||||
|
||||
public static Map<Integer, ItemStack> addItem(final Inventory cinventory, final boolean forceDurability, final boolean dontBreakStacks, final IEssentials ess, final ItemStack... items)
|
||||
public static Map<Integer, ItemStack> addItem(final Inventory cinventory, final boolean forceDurability, final boolean dontBreakStacks, final ItemStack... items)
|
||||
{
|
||||
final Map<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>();
|
||||
|
||||
@ -147,10 +147,10 @@ public final class InventoryWorkaround
|
||||
else
|
||||
{
|
||||
// More than a single stack!
|
||||
if (item.getAmount() > (dontBreakStacks ? ess.getSettings().getDefaultStackSize() : item.getType().getMaxStackSize()))
|
||||
if (item.getAmount() > (dontBreakStacks ? 64 : item.getType().getMaxStackSize()))
|
||||
{
|
||||
ItemStack stack = item.clone();
|
||||
stack.setAmount(dontBreakStacks ? ess.getSettings().getDefaultStackSize() : item.getType().getMaxStackSize());
|
||||
stack.setAmount(dontBreakStacks ? 64 : item.getType().getMaxStackSize());
|
||||
if (cinventory instanceof FakeInventory)
|
||||
{
|
||||
cinventory.setItem(firstFree, stack);
|
||||
@ -183,7 +183,7 @@ public final class InventoryWorkaround
|
||||
|
||||
final int amount = item.getAmount();
|
||||
final int partialAmount = partialItem.getAmount();
|
||||
final int maxAmount = dontBreakStacks ? ess.getSettings().getDefaultStackSize() : partialItem.getType().getMaxStackSize();
|
||||
final int maxAmount = dontBreakStacks ? 64 : partialItem.getType().getMaxStackSize();
|
||||
|
||||
// Check if it fully fits
|
||||
if (amount + partialAmount <= maxAmount)
|
||||
|
@ -77,7 +77,7 @@ public class Commandgive extends EssentialsCommand
|
||||
final User giveTo = getPlayer(server, args, 0);
|
||||
final String itemName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' ');
|
||||
sender.sendMessage(ChatColor.BLUE + "Giving " + stack.getAmount() + " of " + itemName + " to " + giveTo.getDisplayName() + ".");
|
||||
InventoryWorkaround.addItem(giveTo.getInventory(), true, true, ess, stack);
|
||||
InventoryWorkaround.addItem(giveTo.getInventory(), true, true, stack);
|
||||
giveTo.updateInventory();
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class Commanditem extends EssentialsCommand
|
||||
|
||||
final String displayName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' ');
|
||||
user.sendMessage(_("itemSpawn", stack.getAmount(), displayName));
|
||||
InventoryWorkaround.addItem(user.getInventory(), true, true, ess, stack);
|
||||
InventoryWorkaround.addItem(user.getInventory(), true, true, stack);
|
||||
user.updateInventory();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user