mirror of
https://github.com/PaperMC/Velocity.git
synced 2025-01-24 14:54:03 +08:00
Add shutdown flag.
This commit is contained in:
parent
05693425bf
commit
a7a227ed05
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user