From 902936ddd71bb432c3a57f1e693a29d182f84ac8 Mon Sep 17 00:00:00 2001 From: Gravit Date: Thu, 4 Apr 2019 19:02:12 +0700 Subject: [PATCH] =?UTF-8?q?[REFRACTOR]=20=D0=A7=D0=B8=D1=81=D1=82=D0=BA?= =?UTF-8?q?=D0=B0=20LauncherConfig=20=D0=BE=D1=82=20=D0=BA=D0=BE=D0=B4?= =?UTF-8?q?=D0=B0=20=D1=81=D1=82=D0=B0=D1=80=D0=BE=D0=B3=D0=BE=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D1=82=D0=BE=D0=BA=D0=BE=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../launchserver/binary/JAConfigurator.java | 24 ------------------- .../binary/tasks/MainBuildTask.java | 8 +------ .../launcher/client/ClientLauncher.java | 2 +- .../websockets/LegacyRequestBridge.java | 3 +-- .../gravit/launcher/server/ServerWrapper.java | 3 +-- .../ru/gravit/launcher/AutogenConfig.java | 4 ---- .../ru/gravit/launcher/LauncherConfig.java | 10 +++----- 7 files changed, 7 insertions(+), 47 deletions(-) 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 d1d84feb..dfe913d3 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JAConfigurator.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JAConfigurator.java @@ -71,12 +71,6 @@ public void setAddress(String address) { body.append("\";"); } - public void setNettyAddress(String address) { - body.append("this.nettyAddress = \""); - body.append(address); - body.append("\";"); - } - public void setProjectName(String name) { body.append("this.projectname = \""); body.append(name); @@ -89,18 +83,6 @@ public void setSecretKey(String key) { body.append("\";"); } - public void setPort(int port) { - body.append("this.port = "); - body.append(port); - body.append(";"); - } - - public void setNettyPort(int port) { - body.append("this.nettyPort = "); - body.append(port); - body.append(";"); - } - public void setEnv(LauncherConfig.LauncherEnvironment env) { int i = 2; switch (env) { @@ -141,12 +123,6 @@ public void setDownloadJava(boolean b) { body.append(";"); } - public void setNettyEnabled(boolean b) { - body.append("this.isNettyEnabled = "); - body.append(b ? "true" : "false"); - body.append(";"); - } - public void setWarningMissArchJava(boolean b) { body.append("this.isWarningMissArchJava = "); body.append(b ? "true" : "false"); diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/MainBuildTask.java b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/MainBuildTask.java index bdc9df17..916783ea 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/MainBuildTask.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/MainBuildTask.java @@ -128,13 +128,7 @@ public Path process(Path inputJar) throws IOException { }); BuildContext context = new BuildContext(output, jaConfigurator, this); server.buildHookManager.hook(context); - jaConfigurator.setAddress(server.config.getAddress()); - jaConfigurator.setPort(server.config.port); - jaConfigurator.setNettyEnabled(server.config.netty.clientEnabled); - if (server.config.netty.clientEnabled) { - jaConfigurator.setNettyPort(server.config.netty.port); - jaConfigurator.setNettyAddress(server.config.netty.address); - } + jaConfigurator.setAddress(server.config.netty.address); if (server.config.guardLicense != null) jaConfigurator.setGuardLicense(server.config.guardLicense.name, server.config.guardLicense.key, server.config.guardLicense.encryptKey); jaConfigurator.setProjectName(server.config.projectName); 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 65392935..aec75662 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java +++ b/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java @@ -477,7 +477,7 @@ public static void main(String... args) throws Throwable { LogHelper.debug("WebSocket connect closed. Try reconnect"); try { if (!LegacyRequestBridge.service.reconnectBlocking()) LogHelper.error("Error connecting"); - LogHelper.debug("Connect to %s", Launcher.getConfig().nettyAddress); + LogHelper.debug("Connect to %s", Launcher.getConfig().address); } catch (InterruptedException e) { e.printStackTrace(); } diff --git a/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/LegacyRequestBridge.java b/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/LegacyRequestBridge.java index 0fe13dec..ee3e7f1b 100644 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/LegacyRequestBridge.java +++ b/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/LegacyRequestBridge.java @@ -55,7 +55,6 @@ public static void initWebSockets(String address) { } static { - if (Launcher.getConfig().nettyPort != 0) - initWebSockets(Launcher.getConfig().nettyAddress); + initWebSockets(Launcher.getConfig().address); } } diff --git a/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java b/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java index a173dd2f..115f978b 100644 --- a/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java +++ b/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java @@ -203,8 +203,7 @@ public void updateLauncherConfig() { if(config.websocket != null && config.websocket.enabled) { cfg.isNettyEnabled = true; - cfg.nettyAddress = config.websocket.address; - cfg.nettyPort = 1111; + cfg.address = config.websocket.address; } } catch (InvalidKeySpecException | IOException e) { LogHelper.error(e); diff --git a/libLauncher/src/main/java/ru/gravit/launcher/AutogenConfig.java b/libLauncher/src/main/java/ru/gravit/launcher/AutogenConfig.java index 508333fa..e0c26129 100644 --- a/libLauncher/src/main/java/ru/gravit/launcher/AutogenConfig.java +++ b/libLauncher/src/main/java/ru/gravit/launcher/AutogenConfig.java @@ -3,15 +3,11 @@ public class AutogenConfig { public String projectname; public String address; - public String nettyAddress; - public int port; - public int nettyPort; public int clientPort; @SuppressWarnings("unused") private boolean isInitModules; public boolean isUsingWrapper; public boolean isDownloadJava; //Выставление этого флага требует модификации runtime части - public boolean isNettyEnabled; public String secretKeyClient; public String guardLicenseName; public String guardLicenseKey; diff --git a/libLauncher/src/main/java/ru/gravit/launcher/LauncherConfig.java b/libLauncher/src/main/java/ru/gravit/launcher/LauncherConfig.java index 01be3c97..4ffb54d8 100644 --- a/libLauncher/src/main/java/ru/gravit/launcher/LauncherConfig.java +++ b/libLauncher/src/main/java/ru/gravit/launcher/LauncherConfig.java @@ -20,8 +20,7 @@ public static AutogenConfig getAutogenConfig() { } // Instance - public String nettyAddress; - public int nettyPort; + public String address; @LauncherAPI public final String projectname; public final int clientPort; @@ -53,9 +52,6 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException guardLicenseEncryptKey = config.guardLicenseEncryptKey; guardLicenseKey = config.guardLicenseKey; guardLicenseName = config.guardLicenseName; - nettyPort = config.nettyPort; - nettyAddress = config.nettyAddress; - isNettyEnabled = config.isNettyEnabled; LauncherEnvironment env; if (config.env == 0) env = LauncherEnvironment.DEV; else if (config.env == 1) env = LauncherEnvironment.DEBUG; @@ -77,7 +73,7 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException @LauncherAPI public LauncherConfig(String address, RSAPublicKey publicKey, Map runtime, String projectname) { - this.nettyAddress = address; + this.address = address; this.publicKey = Objects.requireNonNull(publicKey, "publicKey"); this.runtime = Collections.unmodifiableMap(new HashMap<>(runtime)); this.projectname = projectname; @@ -93,7 +89,7 @@ public LauncherConfig(String address, RSAPublicKey publicKey, Map runtime) { - this.nettyAddress = address; + this.address = address; this.publicKey = Objects.requireNonNull(publicKey, "publicKey"); this.runtime = Collections.unmodifiableMap(new HashMap<>(runtime)); this.projectname = "Minecraft";