use of net.glowstone.net.GameServer in project Glowstone by GlowstoneMC.
the class GlowServer method bind.
private void bind() {
if (Networking.EPOLL_AVAILABLE) {
ConsoleMessages.Info.NativeTransport.EPOLL.log();
} else if (Networking.KQUEUE_AVAILABLE) {
ConsoleMessages.Info.NativeTransport.KQUEUE.log();
}
CountDownLatch latch = new CountDownLatch(3);
ProtocolProvider protocolProvider = new ProtocolProvider(config);
networkServer = new GameServer(this, protocolProvider, latch);
networkServer.bind(getBindAddress(Key.SERVER_PORT));
if (config.getBoolean(Key.QUERY_ENABLED)) {
queryServer = new QueryServer(this, protocolProvider, latch, config.getBoolean(Key.QUERY_PLUGINS));
queryServer.bind(getBindAddress(Key.QUERY_PORT));
} else {
latch.countDown();
}
if (config.getBoolean(Key.RCON_ENABLED)) {
rconServer = new RconServer(this, protocolProvider, latch, config.getString(Key.RCON_PASSWORD));
rconServer.bind(getBindAddress(Key.RCON_PORT));
} else {
latch.countDown();
}
try {
latch.await();
} catch (InterruptedException e) {
ConsoleMessages.Error.Rcon.BIND_INTERRUPTED.log(e);
System.exit(1);
}
}
Aggregations