Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-17 05:20:14 +01:00
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();
|
||||
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;
|
||||
logger.info("Done ({}s)!", new DecimalFormat("#.##").format(bootTime));
|
||||
|
@ -229,7 +229,7 @@ public class VelocityServer implements ProxyServer {
|
||||
return shutdown;
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
public void shutdown(boolean explicitExit) {
|
||||
if (eventManager == null || pluginManager == null || cm == null || scheduler == null) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
@ -256,6 +256,10 @@ public class VelocityServer implements ProxyServer {
|
||||
}
|
||||
|
||||
shutdown = true;
|
||||
|
||||
if (explicitExit) {
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
return;
|
||||
}
|
||||
server.shutdown();
|
||||
server.shutdown(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -88,7 +88,7 @@ public final class VelocityConsole extends SimpleTerminalConsole implements Comm
|
||||
|
||||
@Override
|
||||
protected void shutdown() {
|
||||
this.server.shutdown();
|
||||
this.server.shutdown(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren