Search in sources :

Example 1 with GameServer

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);
    }
}
Also used : QueryServer(net.glowstone.net.query.QueryServer) RconServer(net.glowstone.net.rcon.RconServer) ProtocolProvider(net.glowstone.net.protocol.ProtocolProvider) CountDownLatch(java.util.concurrent.CountDownLatch) GameServer(net.glowstone.net.GameServer)

Aggregations

CountDownLatch (java.util.concurrent.CountDownLatch)1 GameServer (net.glowstone.net.GameServer)1 ProtocolProvider (net.glowstone.net.protocol.ProtocolProvider)1 QueryServer (net.glowstone.net.query.QueryServer)1 RconServer (net.glowstone.net.rcon.RconServer)1