package net.hexid.hexbot;

import java.util.Arrays;
import net.hexid.hexbot.bot.Bots;
import net.hexid.hexbot.bot.gui.BotGUI;
import net.hexid.hexbot.bot.cmd.BotCMD;

public class HexBot {
	public HexBot() {
		Bots.addBot("astral", "Astral WoW", "net.hexid.hexbot.bots.Astral", "net.hexid.hexbot.bots.AstralTab", "Astral.coffee");
		Bots.addBot("bing", "Bing Rewards", "net.hexid.hexbot.bots.Bing", "net.hexid.hexbot.bots.BingTab", "Bing.coffee");
		Bots.addBot("imgur", "Imgur Albums", "net.hexid.hexbot.bots.Imgur", "net.hexid.hexbot.bots.ImgurTab", "Imgur.coffee");
		Bots.addBot("molten", "Molten WoW", "net.hexid.hexbot.bots.Molten", "net.hexid.hexbot.bots.MoltenTab", "Molten.coffee");
		Bots.addBot("test", "Test", "net.hexid.hexbot.bots.Test", "net.hexid.hexbot.bots.TestTab", "Test.coffee");
		Bots.addBot("xbox", "Xbox Codes", "net.hexid.hexbot.bots.Xbox", "net.hexid.hexbot.bots.XboxTab", "Xbox.coffee");
	}

	protected void init(String[] args) {
		Bots.removeInvalidBots();

		// if more than 1 argument and the first is `gui` -- or there are no arguments
		if((args.length >= 1 && args[0].equalsIgnoreCase("gui")) || args.length == 0) {
			BotGUI.init(Arrays.copyOfRange(args, (args.length > 0) ? 1 : 0, args.length));
		} else { // otherwise use the command line
			BotCMD.init(args);
		}
	}

	public static void main(String[] args) {
		HexBot hexbot = new HexBot();
		hexbot.init(args);
	}
}

@@ -992,19 +992,20 @@
  if 
-more than 1
+there are no
  arg
@@ -1013,12 +1013,12 @@
 ment
- and
+s of
  the
@@ -1036,44 +1036,14 @@
 gui%60
- -- or there are no arguments
 %0A%09%09if(
-(
 args
@@ -1054,15 +1054,15 @@
 gth 
-%3E= 1 &&
+== 0 %7C%7C
  arg
@@ -1094,29 +1094,8 @@
 i%22))
- %7C%7C args.length == 0)
  %7B%0A%09

Refactor how CMD/GUI is determined to require fewer calculations