diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JAConfigurator.java b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JAConfigurator.java index 4668bc97..5f7edde8 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JAConfigurator.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JAConfigurator.java @@ -19,6 +19,7 @@ public JAConfigurator(Class configclass) throws NotFoundException { ctConstructor = ctClass.getDeclaredConstructor(null); initModuleMethod = ctClass.getDeclaredMethod("initModules"); body = new StringBuilder("{ isInitModules = false; "); + moduleBody = new StringBuilder("{ isInitModules = true; "); autoincrement = 0; } public void addModuleClass(String fullName) @@ -39,6 +40,7 @@ public void close() { } public byte[] getBytecode() throws IOException, CannotCompileException { body.append("}"); + moduleBody.append("}"); ctConstructor.setBody(body.toString()); initModuleMethod.insertAfter(moduleBody.toString()); return ctClass.toBytecode(); diff --git a/Launcher/src/main/java/ru/gravit/launcher/LauncherEngine.java b/Launcher/src/main/java/ru/gravit/launcher/LauncherEngine.java index 3be034ab..b5045e94 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/LauncherEngine.java +++ b/Launcher/src/main/java/ru/gravit/launcher/LauncherEngine.java @@ -190,7 +190,7 @@ private void setScriptBindings() { @LauncherAPI public void start(String... args) throws Throwable { Launcher.modulesManager = new ClientModuleManager(this); - LauncherConfig.getAutogenConfig(); //INIT + LauncherConfig.getAutogenConfig().initModules(); //INIT Launcher.modulesManager.preInitModules(); Objects.requireNonNull(args, "args"); if (started.getAndSet(true)) diff --git a/Launcher/src/main/java/ru/gravit/launcher/server/ServerWrapper.java b/Launcher/src/main/java/ru/gravit/launcher/server/ServerWrapper.java index b2f4305d..b78f4258 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/server/ServerWrapper.java +++ b/Launcher/src/main/java/ru/gravit/launcher/server/ServerWrapper.java @@ -20,12 +20,6 @@ public class ServerWrapper { public static ModulesManager modulesManager; 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(); modulesManager = new ModulesManager(wrapper); modulesManager.autoload(Paths.get("modules"));