Search in sources :

Example 1 with PingMessage

use of net.glowstone.net.message.play.game.PingMessage in project Glowstone by GlowstoneMC.

the class GlowSession method idle.

/**
     * Notify that the session is currently idle.
     */
public void idle() {
    if (pingMessageId == 0 && getProtocol() instanceof PlayProtocol) {
        pingMessageId = random.nextInt();
        if (pingMessageId == 0) {
            pingMessageId++;
        }
        send(new PingMessage(pingMessageId));
    } else {
        disconnect("Timed out");
    }
}
Also used : PlayProtocol(net.glowstone.net.protocol.PlayProtocol) PingMessage(net.glowstone.net.message.play.game.PingMessage)

Aggregations

PingMessage (net.glowstone.net.message.play.game.PingMessage)1 PlayProtocol (net.glowstone.net.protocol.PlayProtocol)1