diff --git a/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java b/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java index 5be74320..a567d4ce 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java +++ b/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java @@ -336,6 +336,9 @@ public static Process launch( checkJVMBitsAndVersion(); LogHelper.debug("Resolving JVM binary"); Path javaBin = LauncherGuardManager.getGuardJavaBinPath(); + context.javaBin = javaBin; + context.clientProfile = profile; + context.playerProfile = params.pp; context.args.add(javaBin.toString()); context.args.add(MAGICAL_INTEL_OPTION); if (params.ram > 0 && params.ram <= JVMHelper.RAM) { diff --git a/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncherContext.java b/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncherContext.java index 8baad567..c02fcb2c 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncherContext.java +++ b/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncherContext.java @@ -1,5 +1,8 @@ package ru.gravit.launcher.client; +import ru.gravit.launcher.profiles.ClientProfile; +import ru.gravit.launcher.profiles.PlayerProfile; + import java.nio.file.Path; import java.util.LinkedList; import java.util.List; @@ -9,4 +12,6 @@ public class ClientLauncherContext { public List args = new LinkedList<>(); public String pathLauncher; public ProcessBuilder builder; + public ClientProfile clientProfile; + public PlayerProfile playerProfile; } diff --git a/Launcher/src/main/java/ru/gravit/launcher/guard/LauncherWrapperGuard.java b/Launcher/src/main/java/ru/gravit/launcher/guard/LauncherWrapperGuard.java index 63a7f593..5f55acfb 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/guard/LauncherWrapperGuard.java +++ b/Launcher/src/main/java/ru/gravit/launcher/guard/LauncherWrapperGuard.java @@ -56,16 +56,14 @@ public void addCustomEnv(ClientLauncherContext context) { Map env = context.builder.environment(); env.put("JAVA_HOME", System.getProperty("java.home")); LauncherConfig config = Launcher.getConfig(); + env.put("GUARD_USERNAME", context.playerProfile.username); + env.put("GUARD_PUBLICKEY", config.publicKey.getModulus().toString(16)); + env.put("GUARD_PROJECTNAME", config.projectname); if(config.guardLicenseName != null) env.put("GUARD_LICENSE_NAME", config.guardLicenseName); - if(config.guardLicenseKey != null && config.guardLicenseEncryptKey != null) + if(config.guardLicenseKey != null) { - try { - byte[] encrypt = SecurityHelper.encrypt(config.guardLicenseEncryptKey,config.guardLicenseKey); - env.put("GUARD_LICENSE_NAME", Base64.getEncoder().encodeToString(encrypt)); - } catch (Exception e) { - LogHelper.error(e); - } + env.put("GUARD_LICENSE_KEY", config.guardLicenseKey); } } }