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());
}
Aggregations