/*
 * Copyright  2014 - 2017 | Wurst-Imperium | All rights reserved.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package net.wurstclient.bot.commands;

import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.GuiConnecting;
import net.minecraft.client.multiplayer.ServerData;
import net.wurstclient.gui.main.GuiWurstMainMenu;

@Command.Info(help = "Joins a server.", name = "join", syntax = {"<ip>"})
public class JoinCmd extends Command
{
	@Override
	public void execute(final String[] args) throws CmdError
	{
		if(args.length != 1)
			syntaxError();
		Minecraft.getMinecraft().addScheduledTask(new Runnable()
		{
			@Override
			public void run()
			{
				Minecraft.getMinecraft()
					.displayGuiScreen(new GuiConnecting(new GuiWurstMainMenu(),
						Minecraft.getMinecraft(),
						new ServerData("", args[0], false)));
				System.out.println("Joined " + args[0] + " as "
					+ Minecraft.getMinecraft().session.getUsername());
			}
		});
	}
}

@@ -588,16 +588,22 @@
 %0Apublic 
+final 
 class Jo
@@ -658,22 +658,16 @@
 execute(
-final 
 String%5B%5D
@@ -735,16 +735,34 @@
 or();%0A%09%09
+%0A%09%09Minecraft mc = 
 Minecraf
@@ -777,16 +777,25 @@
 ecraft()
+;%0A%09%09%0A%09%09mc
 .addSche
@@ -808,100 +808,25 @@
 ask(
-new Runnable()%0A%09%09%7B%0A%09%09%09@Override%0A%09%09%09public void run()%0A%09%09%09%7B%0A%09%09%09%09Minecraft.getMinecraft()
+() -%3E %7B%0A%09%09%09
 %0A%09%09%09
-%09%09
+mc
 .dis
@@ -884,43 +884,13 @@
 u(),
-%0A%09%09%09%09%09%09Minecraft.getMinecraft(),%0A%09%09
+ mc,%0A
 %09%09%09%09
@@ -930,16 +930,19 @@
 )));%0A%09%09%09
+%0A%09%09
 %09System.
@@ -953,16 +953,21 @@
 println(
+%0A%09%09%09%09
 %22Joined 
@@ -990,40 +990,13 @@
 as %22
-%0A%09%09%09%09%09+ Minecraft.getMinecraft()
+ + mc
 .ses
@@ -1020,13 +1020,8 @@
 ));%0A
-%09%09%09%7D%0A
 %09%09%7D)

Update JoinCmd