mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-04-27 08:59:45 +00:00
Ignore defaultstacksize from config, just use 64
This commit is contained in:
parent
4614d6d0dd
commit
7268e1965d
3 changed files with 7 additions and 7 deletions
|
@ -81,10 +81,10 @@ public final class InventoryWorkaround
|
||||||
|
|
||||||
public static Map<Integer, ItemStack> addItem(final Inventory cinventory, final boolean forceDurability, final ItemStack... items)
|
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>();
|
final Map<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>();
|
||||||
|
|
||||||
|
@ -147,10 +147,10 @@ public final class InventoryWorkaround
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// More than a single stack!
|
// 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();
|
ItemStack stack = item.clone();
|
||||||
stack.setAmount(dontBreakStacks ? ess.getSettings().getDefaultStackSize() : item.getType().getMaxStackSize());
|
stack.setAmount(dontBreakStacks ? 64 : item.getType().getMaxStackSize());
|
||||||
if (cinventory instanceof FakeInventory)
|
if (cinventory instanceof FakeInventory)
|
||||||
{
|
{
|
||||||
cinventory.setItem(firstFree, stack);
|
cinventory.setItem(firstFree, stack);
|
||||||
|
@ -183,7 +183,7 @@ public final class InventoryWorkaround
|
||||||
|
|
||||||
final int amount = item.getAmount();
|
final int amount = item.getAmount();
|
||||||
final int partialAmount = partialItem.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
|
// Check if it fully fits
|
||||||
if (amount + partialAmount <= maxAmount)
|
if (amount + partialAmount <= maxAmount)
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class Commandgive extends EssentialsCommand
|
||||||
final User giveTo = getPlayer(server, args, 0);
|
final User giveTo = getPlayer(server, args, 0);
|
||||||
final String itemName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' ');
|
final String itemName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' ');
|
||||||
sender.sendMessage(ChatColor.BLUE + "Giving " + stack.getAmount() + " of " + itemName + " to " + giveTo.getDisplayName() + ".");
|
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();
|
giveTo.updateInventory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class Commanditem extends EssentialsCommand
|
||||||
|
|
||||||
final String displayName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' ');
|
final String displayName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' ');
|
||||||
user.sendMessage(_("itemSpawn", stack.getAmount(), displayName));
|
user.sendMessage(_("itemSpawn", stack.getAmount(), displayName));
|
||||||
InventoryWorkaround.addItem(user.getInventory(), true, true, ess, stack);
|
InventoryWorkaround.addItem(user.getInventory(), true, true, stack);
|
||||||
user.updateInventory();
|
user.updateInventory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue