mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-30 17:59:53 +02:00
Add command option /more all
This commit is contained in:
@@ -13,7 +13,20 @@ public class Commandmore extends EssentialsCommand
|
||||
@Override
|
||||
public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
final ItemStack stack = user.getPlayer().getItemInHand();
|
||||
ItemStack[] stacks;
|
||||
if (args.length > 0 && args[0].equalsIgnoreCase("all"))
|
||||
{
|
||||
stacks = user.getPlayer().getInventory().getContents();
|
||||
}
|
||||
else
|
||||
{
|
||||
stacks = new ItemStack[]
|
||||
{
|
||||
user.getPlayer().getItemInHand()
|
||||
};
|
||||
}
|
||||
for (ItemStack stack : stacks)
|
||||
{
|
||||
if (stack == null)
|
||||
{
|
||||
throw new Exception(_("cantSpawnItem", "Air"));
|
||||
@@ -42,6 +55,11 @@ public class Commandmore extends EssentialsCommand
|
||||
{
|
||||
stack.setAmount(defaultStackSize > 0 ? defaultStackSize : stack.getMaxStackSize());
|
||||
}
|
||||
}
|
||||
if (stacks.length > 1)
|
||||
{
|
||||
user.getPlayer().getInventory().setContents(stacks);
|
||||
}
|
||||
user.getPlayer().updateInventory();
|
||||
}
|
||||
}
|
@@ -224,7 +224,7 @@ commands:
|
||||
aliases: [action,describe,eme,eaction,edescribe]
|
||||
more:
|
||||
description: Fills the item stack in hand to maximum size.
|
||||
usage: /<command>
|
||||
usage: /<command> [all]
|
||||
aliases: [emore]
|
||||
motd:
|
||||
description: Views the Message Of The Day.
|
||||
|
Reference in New Issue
Block a user