[FIX] Start Forge 1.18+ server

This commit is contained in:
Gravita 2023-12-14 01:19:36 +07:00
parent 967b81cc85
commit 240e36aab6
3 changed files with 6 additions and 1 deletions

View file

@ -7,6 +7,7 @@
import java.util.UUID;
public class AuthService {
public static String projectName;
public static String username;
public static ClientPermissions permissions = new ClientPermissions();
public static UUID uuid;

View file

@ -177,6 +177,7 @@ private static void realMain(String[] args) throws Throwable {
String glfwPath = ClientService.findLibrary("glfw_wayland");
System.setProperty("org.lwjgl.glfw.libname", glfwPath);
}
AuthService.projectName = Launcher.getConfig().projectName;
AuthService.username = params.playerProfile.username;
AuthService.uuid = params.playerProfile.uuid;
KeyService.serverRsaPublicKey = Launcher.getConfig().rsaPublicKey;

View file

@ -27,6 +27,7 @@
import pro.gravit.utils.helper.SecurityHelper;
import pro.gravit.utils.launch.*;
import java.io.File;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
@ -186,9 +187,11 @@ public void run(String... args) throws Throwable {
switch (config.classLoaderConfig) {
case LAUNCHER:
launch = new LegacyLaunch();
System.setProperty("java.class.path", String.join(File.pathSeparator, config.classpath));
break;
case MODULE:
launch = new ModuleLaunch();
System.setProperty("java.class.path", String.join(File.pathSeparator, config.classpath));
break;
default:
if(ServerAgent.isAgentStarted()) {
@ -213,7 +216,6 @@ public void run(String... args) throws Throwable {
config.configServiceSettings.apply();
}
LogHelper.info("Start Minecraft Server");
LogHelper.debug("Invoke main method %s with %s", classname, launch.getClass().getName());
try {
if(config.compatClasses != null) {
for (String e : config.compatClasses) {
@ -222,6 +224,7 @@ public void run(String... args) throws Throwable {
runMethod.invoke(classLoaderControl);
}
}
LogHelper.debug("Invoke main method %s with %s", classname, launch.getClass().getName());
launch.launch(config.mainclass, config.mainmodule, Arrays.asList(real_args));
} catch (Throwable e) {
LogHelper.error(e);