make exit more friendly
All checks were successful
/ Build BaseBand Loader (push) Successful in 1m43s
All checks were successful
/ Build BaseBand Loader (push) Successful in 1m43s
This commit is contained in:
parent
1b66efcde0
commit
57a3300ce6
1 changed files with 7 additions and 3 deletions
|
@ -191,7 +191,7 @@ public class Loader implements Util {
|
|||
}
|
||||
})
|
||||
.spacer()
|
||||
.option("Exit Minecraft", x -> exit())
|
||||
.option("Exit Minecraft", x -> exit(0))
|
||||
.show();
|
||||
options.setIfAbsent("ip", "baseband.com.de");
|
||||
options.setIfAbsent("disabled-modules", new TCNArray());
|
||||
|
@ -222,7 +222,7 @@ public class Loader implements Util {
|
|||
out.close();
|
||||
LOGGER.info("BaseBand has downloaded a significant update. Minecraft will exit.");
|
||||
JOptionPane.showMessageDialog(null, "BaseBand has downloaded a significant update. Please restart Minecraft.");
|
||||
exit();
|
||||
exit(0);
|
||||
} else if(status == Response.OK) {
|
||||
LOGGER.info(status.name);
|
||||
try {
|
||||
|
@ -349,12 +349,16 @@ public class Loader implements Util {
|
|||
|
||||
|
||||
public static void exit() {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
public static void exit(int exitCode) {
|
||||
try {
|
||||
//Cleanly exit
|
||||
Class<?> shutdownClass = Class.forName("java.lang.Shutdown");
|
||||
Method exitMethod = shutdownClass.getDeclaredMethod("exit", int.class);
|
||||
exitMethod.setAccessible(true);
|
||||
exitMethod.invoke(null, 1);
|
||||
exitMethod.invoke(null, exitCode);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue