mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-06 20:43:11 +00:00
Readded because of popular demand: default-stack-size for /give and /item, values below 1 return max stack size (or oversized stack size).
This commit is contained in:
parent
ad60eb538e
commit
cb89fe5358
5 changed files with 42 additions and 5 deletions
|
@ -41,6 +41,14 @@ public class Commanditem extends EssentialsCommand
|
|||
{
|
||||
stack.setAmount(Integer.parseInt(args[1]));
|
||||
}
|
||||
else if (ess.getSettings().getDefaultStackSize() > 0)
|
||||
{
|
||||
stack.setAmount(ess.getSettings().getDefaultStackSize());
|
||||
}
|
||||
else if (ess.getSettings().getOversizedStackSize() > 0 && user.isAuthorized("essentials.oversizedstacks"))
|
||||
{
|
||||
stack.setAmount(ess.getSettings().getOversizedStackSize());
|
||||
}
|
||||
|
||||
if (args.length > 2)
|
||||
{
|
||||
|
@ -72,9 +80,12 @@ public class Commanditem extends EssentialsCommand
|
|||
|
||||
final String displayName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' ');
|
||||
user.sendMessage(_("itemSpawn", stack.getAmount(), displayName));
|
||||
if (user.isAuthorized("essentials.oversizedstacks")) {
|
||||
if (user.isAuthorized("essentials.oversizedstacks"))
|
||||
{
|
||||
InventoryWorkaround.addItem(user.getInventory(), true, ess.getSettings().getOversizedStackSize(), stack);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
InventoryWorkaround.addItem(user.getInventory(), true, stack);
|
||||
}
|
||||
user.updateInventory();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue