mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-03 01:19:58 +01:00
Allow vanilla syntax of /give
This commit is contained in:
parent
0eefb7f5a1
commit
bb83dcc828
@ -3,6 +3,7 @@ package com.earth2me.essentials.commands;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -44,7 +45,12 @@ public class Commandgive extends EssentialsCommand
|
||||
|
||||
final User giveTo = getPlayer(server, args, 0);
|
||||
|
||||
if (args.length > 2 && Integer.parseInt(args[2]) > 0)
|
||||
if (args.length > 3 && Util.isInt(args[2]) && Util.isInt(args[3]))
|
||||
{
|
||||
stack.setDurability(Short.parseShort(args[2]));
|
||||
stack.setAmount(Integer.parseInt(args[3]));
|
||||
}
|
||||
else if (args.length > 2 && Integer.parseInt(args[2]) > 0)
|
||||
{
|
||||
stack.setAmount(Integer.parseInt(args[2]));
|
||||
}
|
||||
@ -59,7 +65,7 @@ public class Commandgive extends EssentialsCommand
|
||||
|
||||
if (args.length > 3)
|
||||
{
|
||||
for (int i = 3; i < args.length; i++)
|
||||
for (int i = Util.isInt(args[3]) ? 4 : 3; i < args.length; i++)
|
||||
{
|
||||
final String[] split = args[i].split("[:+',;.]", 2);
|
||||
if (split.length < 1)
|
||||
|
@ -21,7 +21,8 @@ public class Commandtime extends EssentialsCommand
|
||||
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
final List<String> argList = new ArrayList<String>(Arrays.asList(args));
|
||||
if ((argList.remove("set") || argList.remove("add")) && Util.isInt(argList.get(0))) {
|
||||
if ((argList.remove("set") || argList.remove("add")) && Util.isInt(argList.get(0)))
|
||||
{
|
||||
ess.getLogger().info("debug edited 0" + argList.get(0).toString());
|
||||
}
|
||||
final String[] validArgs = argList.toArray(new String[0]);
|
||||
|
Loading…
Reference in New Issue
Block a user