diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/MainBuildTask.java b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/MainBuildTask.java index bbe656b9..5805c146 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/MainBuildTask.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/MainBuildTask.java @@ -191,22 +191,7 @@ protected void initProps() { properties.put("launcher.port", 32148 + SecurityHelper.newRandom().nextInt(512)); properties.put("launcher.guardType", server.config.launcher.guardType); properties.put("launcher.isWarningMissArchJava", server.config.launcher.warningMissArchJava); - int cenv = -1; - switch (server.config.env) { - case DEV: - cenv = 0; - break; - case DEBUG: - cenv = 1; - break; - case STD: - cenv = 2; - break; - case PROD: - cenv = 3; - break; - } - properties.put("launchercore.env", cenv); + properties.put("launchercore.env", server.config.env); properties.put("runtimeconfig.passwordEncryptKey", server.runtime.passwordEncryptKey); String launcherSalt = SecurityHelper.randomStringToken(); byte[] launcherSecureHash = SecurityHelper.digest(SecurityHelper.DigestAlgorithm.SHA256, diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/LauncherConfig.java b/LauncherAPI/src/main/java/pro/gravit/launcher/LauncherConfig.java index 906fccb8..7461ecd4 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/LauncherConfig.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/LauncherConfig.java @@ -18,8 +18,6 @@ import java.util.*; public final class LauncherConfig extends StreamObject { - @LauncherInject("launchercore.env") - private static final int cenv = -1; @LauncherInject("launchercore.certificates") private static final List secureConfigCertificates = null; @LauncherInject("launcher.modules") @@ -42,6 +40,7 @@ public final class LauncherConfig extends StreamObject { public final Map runtime; @LauncherInject("launcher.isWarningMissArchJava") public final boolean isWarningMissArchJava; + @LauncherInject("launchercore.env") public LauncherEnvironment environment; @LauncherInject("launcher.guardType") public final String guardType; @@ -52,7 +51,6 @@ public final class LauncherConfig extends StreamObject { @LauncherInject("runtimeconfig.passwordEncryptKey") public final String passwordEncryptKey; - @SuppressWarnings("unused") @LauncherInjectionConstructor public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException { publicKey = SecurityHelper.toPublicECKey(input.readByteArray(SecurityHelper.CRYPTO_MAX_LENGTH)); @@ -72,14 +70,8 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException isWarningMissArchJava = false; guardType = null; address = null; - LauncherEnvironment env; - if (cenv == 0) env = LauncherEnvironment.DEV; - else if (cenv == 1) env = LauncherEnvironment.DEBUG; - else if (cenv == 2) env = LauncherEnvironment.STD; - else if (cenv == 3) env = LauncherEnvironment.PROD; - else env = LauncherEnvironment.STD; - Launcher.applyLauncherEnv(env); - environment = env; + environment = LauncherEnvironment.STD; + Launcher.applyLauncherEnv(environment); // Read signed runtime int count = input.readLength(0); Map localResources = new HashMap<>(count);