From 4828e8e8956f49fbacae9a145432ed0d2d8c0225 Mon Sep 17 00:00:00 2001 From: Gravit Date: Wed, 26 Dec 2018 21:18:10 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D0=B0?= =?UTF-8?q?=20ServerWrapper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gravit/launcher/server/ServerWrapper.java | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) 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 242960aa..e42b62a7 100644 --- a/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java +++ b/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java @@ -33,7 +33,7 @@ public class ServerWrapper { private static GsonBuilder gsonBuiler; public static Path modulesDir = Paths.get(System.getProperty("serverwrapper.modulesDir", "modules")); - public static Path configFile = Paths.get(System.getProperty("serverwrapper.configFile", "ServerWrapper.cfg")); + public static Path configFile = Paths.get(System.getProperty("serverwrapper.configFile", "ServerWrapperConfig.json")); public static Path publicKeyFile = Paths.get(System.getProperty("serverwrapper.publicKeyFile", "public.key")); public static boolean auth(ServerWrapper wrapper) { @@ -85,7 +85,7 @@ public static void main(String[] args) throws Throwable { modulesManager.autoload(modulesDir); Launcher.modulesManager = modulesManager; modulesManager.preInitModules(); - LogHelper.debug("Read LaunchWrapper.cfg"); + LogHelper.debug("Read ServerWrapperConfig.json"); gsonBuiler = new GsonBuilder(); gson = gsonBuiler.create(); generateConfigIfNotExists(); @@ -144,17 +144,23 @@ private static void generateConfigIfNotExists() throws IOException { return; // Create new config - LogHelper.info("Creating LaunchWrapper config"); - Config newConfig; - try(Reader reader = IOHelper.newReader(IOHelper.getResourceURL("ru/gravit/launcher/server/ServerWrapper.cfg"))) - { - newConfig = gson.fromJson(reader,Config.class); - } + LogHelper.info("Creating ServerWrapper config"); + Config newConfig= new Config(); + newConfig.title = "Your profile title"; + newConfig.projectname = "MineCraft"; + newConfig.address = "localhost"; + newConfig.port = 7240; + newConfig.login = "login"; + newConfig.password = "password"; + //try(Reader reader = IOHelper.newReader(IOHelper.getResourceURL("ru/gravit/launcher/server/ServerWrapper.cfg"))) + //{ + // newConfig = gson.fromJson(reader,Config.class); + //} LogHelper.warning("Title is not set. Please show ServerWrapper.cfg"); // Write LaunchServer config - LogHelper.info("Writing LaunchWrapper config file"); + LogHelper.info("Writing ServerWrapper config file"); try(Writer writer = IOHelper.newWriter(configFile)) { gson.toJson(newConfig,writer);