Фиксы ServerWrapper

This commit is contained in:
Gravit 2019-01-03 21:22:59 +07:00
parent f812129d81
commit bac74a7d4f
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
2 changed files with 4 additions and 2 deletions

View file

@ -87,6 +87,7 @@ public static void main(String[] args) throws Throwable {
modulesManager.preInitModules(); modulesManager.preInitModules();
LogHelper.debug("Read ServerWrapperConfig.json"); LogHelper.debug("Read ServerWrapperConfig.json");
gsonBuiler = new GsonBuilder(); gsonBuiler = new GsonBuilder();
gsonBuiler.setPrettyPrinting();
gson = gsonBuiler.create(); gson = gsonBuiler.create();
generateConfigIfNotExists(); generateConfigIfNotExists();
try(Reader reader = IOHelper.newReader(configFile)) try(Reader reader = IOHelper.newReader(configFile))
@ -99,7 +100,7 @@ public static void main(String[] args) throws Throwable {
else else
CommonHelper.newThread("Server Auth Thread", true, () -> ServerWrapper.loopAuth(wrapper, config.reconnectCount, config.reconnectSleep)); CommonHelper.newThread("Server Auth Thread", true, () -> ServerWrapper.loopAuth(wrapper, config.reconnectCount, config.reconnectSleep));
modulesManager.initModules(); modulesManager.initModules();
String classname = config.mainclass.isEmpty() ? args[0] : config.mainclass; String classname = (config.mainclass == null || config.mainclass.isEmpty()) ? args[0] : config.mainclass;
if (classname.length() == 0) { if (classname.length() == 0) {
LogHelper.error("MainClass not found. Please set MainClass for ServerWrapper.cfg or first commandline argument"); LogHelper.error("MainClass not found. Please set MainClass for ServerWrapper.cfg or first commandline argument");
} }
@ -152,6 +153,7 @@ private static void generateConfigIfNotExists() throws IOException {
newConfig.port = 7240; newConfig.port = 7240;
newConfig.login = "login"; newConfig.login = "login";
newConfig.password = "password"; newConfig.password = "password";
newConfig.mainclass = "";
//try(Reader reader = IOHelper.newReader(IOHelper.getResourceURL("ru/gravit/launcher/server/ServerWrapper.cfg"))) //try(Reader reader = IOHelper.newReader(IOHelper.getResourceURL("ru/gravit/launcher/server/ServerWrapper.cfg")))
//{ //{
// newConfig = gson.fromJson(reader,Config.class); // newConfig = gson.fromJson(reader,Config.class);

@ -1 +1 @@
Subproject commit ec1431605c4951ace5cbd2ab392b67cea25bddd5 Subproject commit eec958f2c5edbc7c053686ab7cebaab8dbca2778