Switch to the MCPHackers launchwrapper

This commit is contained in:
zontreck 2024-03-17 02:18:52 -07:00
parent 05edbd1a82
commit e4eecfe145

View file

@ -48,11 +48,6 @@ import java.time.Instant;
import java.util.*;
import javax.swing.JOptionPane;
import dev.zontreck.ariaslib.args.*;
import dev.zontreck.ariaslib.http.HTTPMethod;
import dev.zontreck.ariaslib.http.HTTPRequestBuilder;
import dev.zontreck.ariaslib.http.HTTPResponse;
import dev.zontreck.ariaslib.util.EnvironmentUtils;
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
import org.lwjgl.Sys;
@ -1169,54 +1164,4 @@ public final class Minecraft implements Runnable {
}
public static void main(String[] args)
{
Minecraft minecraft = new Minecraft((Canvas)null, 800, 600, false);
Random rng = new Random();
rng.setSeed(Instant.now().getEpochSecond());
Arguments defaults = ArgumentsBuilder.builder().withArgument(new StringArgument("username", "Player" + String.valueOf(rng.nextInt()).substring(5)))
.build();
Arguments parser = ArgumentsParser.parseArguments(args, defaults);
StringArgument unArg = (StringArgument) parser.getArg("username");
if(parser.hasArg("username")) minecraft.user = new User(unArg.getValue(), System.getProperty("minecraft.auth_token"));
if(parser.hasArg("server"))
{
IntegerArgument serverArg = (IntegerArgument) parser.getArg("server");
// Acquire the server ip and port from Aria's Creations
HTTPResponse response = null;
try {
response = HTTPRequestBuilder.builder()
.withURL("https://api.zontreck.com/crafting/yggdrasil/legacy/server.php")
.withContentType("application/x-www-form-urlencoded")
.withMethod(HTTPMethod.POST)
.withBody("id=" + serverArg.getValue() +
"&username=" + minecraft.user.name)
.build();
} catch (MalformedURLException e) {
System.out.println("An error occured: " + e.getMessage());
throw new RuntimeException(e);
}
if(response.getResponseCode()==200)
{
System.out.println("Response is valid, server found at: " + response.getResponseBody());
String[] lReply = response.getResponseBody().split(";");
minecraft.server = lReply[0];
minecraft.port = Integer.parseInt(lReply[1]);
minecraft.user.mpPass = lReply[2];
}else {
System.out.println("Server could not be found!\nID: " + serverArg.getValue()+ "\nHTTP Response: " + response.getResponseBody());
return;
}
}
new Thread(minecraft).start();
}
}