From b93c7d33eb00e99f79ffc16ec436bea8a290163f Mon Sep 17 00:00:00 2001 From: Gravit Date: Fri, 28 Jun 2019 16:27:05 +0700 Subject: [PATCH] =?UTF-8?q?[FIX]=20json=20=D1=80=D0=B0=D1=81=D1=88=D0=B8?= =?UTF-8?q?=D1=80=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B2=D0=BC=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D0=BE=20conf/cfg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pro/gravit/launchserver/LaunchServer.java | 20 ++++++++++++++++--- .../command/hash/DownloadClientCommand.java | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java index e9feddcb..d2408571 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java @@ -463,8 +463,22 @@ public LaunchServer(Path dir, boolean testEnv, String[] args) throws IOException launcherLibraries = dir.resolve("launcher-libraries"); launcherLibrariesCompile = dir.resolve("launcher-libraries-compile"); this.args = Arrays.asList(args); - configFile = dir.resolve("LaunchServer.conf"); - runtimeConfigFile = dir.resolve("RuntimeLaunchServer.conf"); + if(IOHelper.exists(dir.resolve("LaunchServer.conf"))) + { + configFile = dir.resolve("LaunchServer.conf"); + } + else + { + configFile = dir.resolve("LaunchServer.json"); + } + if(IOHelper.exists(dir.resolve("RuntimeLaunchServer.conf"))) + { + runtimeConfigFile = dir.resolve("RuntimeLaunchServer.conf"); + } + else + { + runtimeConfigFile = dir.resolve("RuntimeLaunchServer.json"); + } publicKeyFile = dir.resolve("public.key"); privateKeyFile = dir.resolve("private.key"); updatesDir = dir.resolve("updates"); @@ -765,7 +779,7 @@ private void generateConfigIfNotExists(boolean testEnv) throws IOException { LogHelper.error("ProjectName null. Using MineCraft"); newConfig.projectName = "MineCraft"; } - + newConfig.netty.address = "ws://" + address + ":9274/api"; newConfig.netty.downloadURL = "http://" + address + ":9274/%dirname%/"; newConfig.netty.launcherURL = "http://" + address + ":9274/Launcher.jar"; diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/DownloadClientCommand.java b/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/DownloadClientCommand.java index 2f32cf6e..26807bc4 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/DownloadClientCommand.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/DownloadClientCommand.java @@ -58,7 +58,7 @@ public void invoke(String... args) throws IOException, CommandException { client.setTitle(dirName); client.setDir(dirName); try (BufferedWriter writer = IOHelper.newWriter(IOHelper.resolveIncremental(server.profilesDir, - dirName, "cfg"))) { + dirName, "json"))) { Launcher.gsonManager.configGson.toJson(client, writer); }