diff --git a/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java b/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java index 97ec06bc..d3d431a9 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java +++ b/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java @@ -8,6 +8,7 @@ import java.util.List; import pro.gravit.launcher.client.ClientLauncher; +import pro.gravit.launcher.client.ClientModuleManager; import pro.gravit.launcher.client.DirBridge; import pro.gravit.utils.helper.EnvHelper; import pro.gravit.utils.helper.IOHelper; @@ -26,6 +27,9 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep JVMHelper.verifySystemProperties(Launcher.class, true); EnvHelper.checkDangerousParams(); LauncherConfig config = Launcher.getConfig(); + LauncherEngine.modulesManager = new ClientModuleManager(); + LauncherConfig.getAutogenConfig().initModules(); + LogHelper.info("Launcher for project %s", config.projectname); if (config.environment.equals(LauncherConfig.LauncherEnvironment.PROD)) { if (System.getProperty(LogHelper.DEBUG_PROPERTY) != null) { @@ -59,6 +63,7 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep Collections.addAll(args, "-cp"); Collections.addAll(args, pathLauncher); Collections.addAll(args, LauncherEngine.class.getName()); + LauncherEngine.modulesManager.callWrapper(processBuilder, args); EnvHelper.addEnv(processBuilder); LogHelper.debug("Commandline: " + args); processBuilder.command(args); diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/ClientModuleManager.java b/Launcher/src/main/java/pro/gravit/launcher/client/ClientModuleManager.java index 90e66237..a5f6343f 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/client/ClientModuleManager.java +++ b/Launcher/src/main/java/pro/gravit/launcher/client/ClientModuleManager.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.nio.file.Path; +import java.util.Collection; import pro.gravit.launcher.modules.LauncherModule; import pro.gravit.launcher.modules.impl.SimpleModuleManager; @@ -25,4 +26,14 @@ public void autoload(Path dir) throws IOException { public LauncherModule loadModule(Path file) throws IOException { throw new UnsupportedOperationException(); } + public void callWrapper(ProcessBuilder processBuilder, Collection jvmArgs) + { + for(LauncherModule module : modules) + { + if(module instanceof ClientWrapperModule) + { + ((ClientWrapperModule) module).wrapperPhase(processBuilder, jvmArgs); + } + } + } } diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/ClientWrapperModule.java b/Launcher/src/main/java/pro/gravit/launcher/client/ClientWrapperModule.java new file mode 100644 index 00000000..4381e6e0 --- /dev/null +++ b/Launcher/src/main/java/pro/gravit/launcher/client/ClientWrapperModule.java @@ -0,0 +1,7 @@ +package pro.gravit.launcher.client; + +import java.util.Collection; + +public interface ClientWrapperModule { + void wrapperPhase(ProcessBuilder processBuilder, Collection jvmArgs); +}