13
0
geforkt von Mirrors/Velocity

Explicitly exit the proxy if required.

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-11-14 01:07:34 -05:00
Ursprung 5e0b9d09e7
Commit 2b0daa2122
4 geänderte Dateien mit 8 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -20,7 +20,7 @@ public class Velocity {
VelocityServer server = new VelocityServer(); VelocityServer server = new VelocityServer();
server.start(); server.start();
Runtime.getRuntime().addShutdownHook(new Thread(server::shutdown, "Shutdown thread")); Runtime.getRuntime().addShutdownHook(new Thread(() -> server.shutdown(false), "Shutdown thread"));
double bootTime = (System.currentTimeMillis() - startTime) / 1000d; double bootTime = (System.currentTimeMillis() - startTime) / 1000d;
logger.info("Done ({}s)!", new DecimalFormat("#.##").format(bootTime)); logger.info("Done ({}s)!", new DecimalFormat("#.##").format(bootTime));

Datei anzeigen

@ -229,7 +229,7 @@ public class VelocityServer implements ProxyServer {
return shutdown; return shutdown;
} }
public void shutdown() { public void shutdown(boolean explicitExit) {
if (eventManager == null || pluginManager == null || cm == null || scheduler == null) { if (eventManager == null || pluginManager == null || cm == null || scheduler == null) {
throw new AssertionError(); throw new AssertionError();
} }
@ -256,6 +256,10 @@ public class VelocityServer implements ProxyServer {
} }
shutdown = true; shutdown = true;
if (explicitExit) {
System.exit(0);
}
} }
public NettyHttpClient getHttpClient() { public NettyHttpClient getHttpClient() {

Datei anzeigen

@ -22,7 +22,7 @@ public class ShutdownCommand implements Command {
.sendMessage(TextComponent.of("You are not allowed to use this command.", TextColor.RED)); .sendMessage(TextComponent.of("You are not allowed to use this command.", TextColor.RED));
return; return;
} }
server.shutdown(); server.shutdown(true);
} }
@Override @Override

Datei anzeigen

@ -88,7 +88,7 @@ public final class VelocityConsole extends SimpleTerminalConsole implements Comm
@Override @Override
protected void shutdown() { protected void shutdown() {
this.server.shutdown(); this.server.shutdown(true);
} }
} }