13
0
geforkt von Mirrors/Velocity

Add shutdown flag.

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-08-07 10:14:34 -04:00
Ursprung 05693425bf
Commit a7a227ed05

Datei anzeigen

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