From 0eefb7f5a160dce1285ccf23899700a57fffa2ff Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sat, 7 Apr 2012 04:22:17 +0100 Subject: [PATCH] Remove 'set' and 'add' from /time command args, to allow use of original syntax. --- .../earth2me/essentials/commands/Commandtime.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtime.java b/Essentials/src/com/earth2me/essentials/commands/Commandtime.java index f22d7d01f..fa1243d45 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtime.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtime.java @@ -3,6 +3,7 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.DescParseTickFormat; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; import java.util.*; import org.bukkit.Server; import org.bukkit.World; @@ -19,16 +20,22 @@ public class Commandtime extends EssentialsCommand @Override public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception { + final List argList = new ArrayList(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()); + } + final String[] validArgs = argList.toArray(new String[0]); + // Which World(s) are we interested in? String worldSelector = null; - if (args.length == 2) + if (validArgs.length == 2) { - worldSelector = args[1]; + worldSelector = validArgs[1]; } final Set worlds = getWorlds(server, sender, worldSelector); // If no arguments we are reading the time - if (args.length == 0) + if (validArgs.length == 0) { getWorldsTime(sender, worlds); return; @@ -45,7 +52,7 @@ public class Commandtime extends EssentialsCommand long ticks; try { - ticks = DescParseTickFormat.parse(args[0]); + ticks = DescParseTickFormat.parse(validArgs[0]); } catch (NumberFormatException e) {