mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-08-20 18:32:49 +00: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,11 +21,12 @@ 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))) {
|
||||
ess.getLogger().info("debug edited 0" + argList.get(0).toString());
|
||||
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]);
|
||||
|
||||
final String[] validArgs = argList.toArray(new String[0]);
|
||||
|
||||
// Which World(s) are we interested in?
|
||||
String worldSelector = null;
|
||||
if (validArgs.length == 2)
|
||||
|
|
Loading…
Reference in a new issue