Search in sources :

Example 1 with Server

use of org.spongepowered.api.Server in project Almura by AlmuraDev.

the class ServerHeadUpDisplayManager method createPlayerCountPacket.

private ClientboundPlayerCountPacket createPlayerCountPacket(final boolean disconnect) {
    final Server server = this.game.getServer();
    // Subtract one from the online player count when a player is disconnecting
    // due to the player not being removed from the online players list until
    // after the disconnect event has been posted.
    final int online = server.getOnlinePlayers().size() - (disconnect ? 1 : 0);
    return new ClientboundPlayerCountPacket(online, server.getMaxPlayers());
}
Also used : Server(org.spongepowered.api.Server) ClientboundPlayerCountPacket(com.almuradev.almura.feature.hud.network.ClientboundPlayerCountPacket)

Aggregations

ClientboundPlayerCountPacket (com.almuradev.almura.feature.hud.network.ClientboundPlayerCountPacket)1 Server (org.spongepowered.api.Server)1