mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-04-15 20:51:45 +03:00
Фикс log4j
This commit is contained in:
parent
8f76bfdf03
commit
f53ed9be52
3 changed files with 3 additions and 7 deletions
|
@ -19,6 +19,7 @@ public JAConfigurator(Class<?> configclass) throws NotFoundException {
|
||||||
ctConstructor = ctClass.getDeclaredConstructor(null);
|
ctConstructor = ctClass.getDeclaredConstructor(null);
|
||||||
initModuleMethod = ctClass.getDeclaredMethod("initModules");
|
initModuleMethod = ctClass.getDeclaredMethod("initModules");
|
||||||
body = new StringBuilder("{ isInitModules = false; ");
|
body = new StringBuilder("{ isInitModules = false; ");
|
||||||
|
moduleBody = new StringBuilder("{ isInitModules = true; ");
|
||||||
autoincrement = 0;
|
autoincrement = 0;
|
||||||
}
|
}
|
||||||
public void addModuleClass(String fullName)
|
public void addModuleClass(String fullName)
|
||||||
|
@ -39,6 +40,7 @@ public void close() {
|
||||||
}
|
}
|
||||||
public byte[] getBytecode() throws IOException, CannotCompileException {
|
public byte[] getBytecode() throws IOException, CannotCompileException {
|
||||||
body.append("}");
|
body.append("}");
|
||||||
|
moduleBody.append("}");
|
||||||
ctConstructor.setBody(body.toString());
|
ctConstructor.setBody(body.toString());
|
||||||
initModuleMethod.insertAfter(moduleBody.toString());
|
initModuleMethod.insertAfter(moduleBody.toString());
|
||||||
return ctClass.toBytecode();
|
return ctClass.toBytecode();
|
||||||
|
|
|
@ -190,7 +190,7 @@ private void setScriptBindings() {
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public void start(String... args) throws Throwable {
|
public void start(String... args) throws Throwable {
|
||||||
Launcher.modulesManager = new ClientModuleManager(this);
|
Launcher.modulesManager = new ClientModuleManager(this);
|
||||||
LauncherConfig.getAutogenConfig(); //INIT
|
LauncherConfig.getAutogenConfig().initModules(); //INIT
|
||||||
Launcher.modulesManager.preInitModules();
|
Launcher.modulesManager.preInitModules();
|
||||||
Objects.requireNonNull(args, "args");
|
Objects.requireNonNull(args, "args");
|
||||||
if (started.getAndSet(true))
|
if (started.getAndSet(true))
|
||||||
|
|
|
@ -20,12 +20,6 @@
|
||||||
public class ServerWrapper {
|
public class ServerWrapper {
|
||||||
public static ModulesManager modulesManager;
|
public static ModulesManager modulesManager;
|
||||||
public static void main(String[] args) throws Throwable {
|
public static void main(String[] args) throws Throwable {
|
||||||
if(System.getProperty("log4j.configurationFile") == null)
|
|
||||||
try(InputStream stream = IOHelper.newInput(IOHelper.getResourceURL("log4j2.xml"))) {
|
|
||||||
System.setProperty("log4j.configurationFile", "launcher/log4j2.xml,log4j2.xml");
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.setProperty("log4j.configurationFile", "ru/gravit/launcher/log4j2.xml");
|
|
||||||
}
|
|
||||||
ServerWrapper wrapper = new ServerWrapper();
|
ServerWrapper wrapper = new ServerWrapper();
|
||||||
modulesManager = new ModulesManager(wrapper);
|
modulesManager = new ModulesManager(wrapper);
|
||||||
modulesManager.autoload(Paths.get("modules"));
|
modulesManager.autoload(Paths.get("modules"));
|
||||||
|
|
Loading…
Reference in a new issue