mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-04-03 23:11:57 +03:00
Merge remote-tracking branch 'origin/master' into patchy
This commit is contained in:
commit
68109c1ea3
5 changed files with 15 additions and 5 deletions
|
@ -384,7 +384,6 @@ public LaunchServer(Path dir, String[] args) throws IOException, InvalidKeySpecE
|
||||||
modulesManager.autoload(dir.resolve("modules"));
|
modulesManager.autoload(dir.resolve("modules"));
|
||||||
modulesManager.preInitModules();
|
modulesManager.preInitModules();
|
||||||
initGson();
|
initGson();
|
||||||
LogHelper.setStacktraceEnabled(true);
|
|
||||||
|
|
||||||
// Read LaunchServer config
|
// Read LaunchServer config
|
||||||
generateConfigIfNotExists();
|
generateConfigIfNotExists();
|
||||||
|
|
|
@ -11,22 +11,29 @@ public DebugCommand(LaunchServer server) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getArgsDescription() {
|
public String getArgsDescription() {
|
||||||
return "[true/false]";
|
return "[true/false] (true/false)";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUsageDescription() {
|
public String getUsageDescription() {
|
||||||
return "Enable or disable debug logging at runtime";
|
return "Enable or disable debug and stacktrace logging at runtime";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invoke(String... args) {
|
public void invoke(String... args) {
|
||||||
boolean newValue;
|
boolean newValue, newTraceValue;
|
||||||
if (args.length >= 1) {
|
if (args.length >= 1) {
|
||||||
newValue = Boolean.parseBoolean(args[0]);
|
newValue = Boolean.parseBoolean(args[0]);
|
||||||
|
if(args.length >= 2) newTraceValue = Boolean.parseBoolean(args[1]);
|
||||||
|
else newTraceValue = newValue;
|
||||||
LogHelper.setDebugEnabled(newValue);
|
LogHelper.setDebugEnabled(newValue);
|
||||||
|
LogHelper.setStacktraceEnabled(newTraceValue);
|
||||||
} else
|
} else
|
||||||
|
{
|
||||||
newValue = LogHelper.isDebugEnabled();
|
newValue = LogHelper.isDebugEnabled();
|
||||||
|
newTraceValue = LogHelper.isStacktraceEnabled();
|
||||||
|
}
|
||||||
LogHelper.subInfo("Debug enabled: " + newValue);
|
LogHelper.subInfo("Debug enabled: " + newValue);
|
||||||
|
LogHelper.subInfo("Stacktrace enabled: " + newTraceValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep
|
||||||
args.add(javaBin.toString());
|
args.add(javaBin.toString());
|
||||||
String pathLauncher = IOHelper.getCodeSource(ClientLauncher.class).toString();
|
String pathLauncher = IOHelper.getCodeSource(ClientLauncher.class).toString();
|
||||||
args.add(JVMHelper.jvmProperty(LogHelper.DEBUG_PROPERTY, Boolean.toString(LogHelper.isDebugEnabled())));
|
args.add(JVMHelper.jvmProperty(LogHelper.DEBUG_PROPERTY, Boolean.toString(LogHelper.isDebugEnabled())));
|
||||||
|
args.add(JVMHelper.jvmProperty(LogHelper.STACKTRACE_PROPERTY, Boolean.toString(LogHelper.isStacktraceEnabled())));
|
||||||
Collections.addAll(args, "-javaagent:".concat(pathLauncher));
|
Collections.addAll(args, "-javaagent:".concat(pathLauncher));
|
||||||
Collections.addAll(args, "-cp");
|
Collections.addAll(args, "-cp");
|
||||||
Collections.addAll(args, pathLauncher);
|
Collections.addAll(args, pathLauncher);
|
||||||
|
|
|
@ -356,6 +356,7 @@ public static Process launch(
|
||||||
args.add("-Xmx" + params.ram + 'M');
|
args.add("-Xmx" + params.ram + 'M');
|
||||||
}
|
}
|
||||||
args.add(JVMHelper.jvmProperty(LogHelper.DEBUG_PROPERTY, Boolean.toString(LogHelper.isDebugEnabled())));
|
args.add(JVMHelper.jvmProperty(LogHelper.DEBUG_PROPERTY, Boolean.toString(LogHelper.isDebugEnabled())));
|
||||||
|
args.add(JVMHelper.jvmProperty(LogHelper.STACKTRACE_PROPERTY, Boolean.toString(LogHelper.isStacktraceEnabled())));
|
||||||
if (LauncherConfig.ADDRESS_OVERRIDE != null)
|
if (LauncherConfig.ADDRESS_OVERRIDE != null)
|
||||||
args.add(JVMHelper.jvmProperty(LauncherConfig.ADDRESS_OVERRIDE_PROPERTY, LauncherConfig.ADDRESS_OVERRIDE));
|
args.add(JVMHelper.jvmProperty(LauncherConfig.ADDRESS_OVERRIDE_PROPERTY, LauncherConfig.ADDRESS_OVERRIDE));
|
||||||
if (JVMHelper.OS_TYPE == OS.MUSTDIE) {
|
if (JVMHelper.OS_TYPE == OS.MUSTDIE) {
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue