geforkt von Mirrors/Velocity
Explicitly exit the proxy if required.
Dieser Commit ist enthalten in:
Ursprung
5e0b9d09e7
Commit
2b0daa2122
@ -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));
|
||||||
|
@ -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() {
|
||||||
|
@ -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
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren