mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FEATURE] Support compat classes in ServerWrapper
This commit is contained in:
parent
f2cbf0ed38
commit
b638efc0d1
1 changed files with 11 additions and 0 deletions
|
@ -24,6 +24,9 @@
|
||||||
import pro.gravit.utils.helper.SecurityHelper;
|
import pro.gravit.utils.helper.SecurityHelper;
|
||||||
import pro.gravit.utils.launch.*;
|
import pro.gravit.utils.launch.*;
|
||||||
|
|
||||||
|
import java.lang.invoke.MethodHandle;
|
||||||
|
import java.lang.invoke.MethodHandles;
|
||||||
|
import java.lang.invoke.MethodType;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
@ -191,6 +194,13 @@ public void run(String... args) throws Throwable {
|
||||||
LogHelper.info("Start Minecraft Server");
|
LogHelper.info("Start Minecraft Server");
|
||||||
LogHelper.debug("Invoke main method %s with %s", classname, launch.getClass().getName());
|
LogHelper.debug("Invoke main method %s with %s", classname, launch.getClass().getName());
|
||||||
try {
|
try {
|
||||||
|
if(config.compatClasses != null) {
|
||||||
|
for (String e : config.compatClasses) {
|
||||||
|
Class<?> clazz = classLoaderControl.getClass(e);
|
||||||
|
MethodHandle runMethod = MethodHandles.lookup().findStatic(clazz, "run", MethodType.methodType(void.class, ClassLoaderControl.class));
|
||||||
|
runMethod.invoke(classLoaderControl);
|
||||||
|
}
|
||||||
|
}
|
||||||
launch.launch(config.mainclass, config.mainmodule, Arrays.asList(real_args));
|
launch.launch(config.mainclass, config.mainmodule, Arrays.asList(real_args));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
LogHelper.error(e);
|
LogHelper.error(e);
|
||||||
|
@ -242,6 +252,7 @@ public static final class Config {
|
||||||
public String mainmodule;
|
public String mainmodule;
|
||||||
public String nativesDir = "natives";
|
public String nativesDir = "natives";
|
||||||
public List<String> args;
|
public List<String> args;
|
||||||
|
public List<String> compatClasses;
|
||||||
public String authId;
|
public String authId;
|
||||||
public AuthRequestEvent.OAuthRequestEvent oauth;
|
public AuthRequestEvent.OAuthRequestEvent oauth;
|
||||||
public long oauthExpireTime;
|
public long oauthExpireTime;
|
||||||
|
|
Loading…
Reference in a new issue