Add shutdown flag.
This commit is contained in:
@@ -49,6 +49,7 @@ public class VelocityServer implements ProxyServer {
|
||||
private KeyPair serverKeyPair;
|
||||
private final ServerMap servers = new ServerMap();
|
||||
private final CommandManager commandManager = new CommandManager();
|
||||
private boolean shutdown = false;
|
||||
|
||||
private final Map<UUID, ConnectedPlayer> connectionsByUuid = new ConcurrentHashMap<>();
|
||||
private final Map<String, ConnectedPlayer> connectionsByName = new ConcurrentHashMap<>();
|
||||
@@ -134,7 +135,16 @@ public class VelocityServer implements ProxyServer {
|
||||
return this.cm.createWorker();
|
||||
}
|
||||
|
||||
public boolean isShutdown() {
|
||||
return shutdown;
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
Preconditions.checkState(!shutdown, "Server already shut down");
|
||||
shutdown = true;
|
||||
|
||||
logger.info("Shutting down the proxy...");
|
||||
|
||||
this.cm.shutdown();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user