CountTotalPlayers() public static method

public static CountTotalPlayers ( ) : int
return int
Exemplo n.º 1
0
        internal static void ServerInfo(Player player, Command cmd)
        {
            Process.GetCurrentProcess().Refresh();

            player.Message("Servers stats: Up for {0:0.0} hours, using {1:0} MB of memory",
                           DateTime.UtcNow.Subtract(Server.ServerStart).TotalHours,
                           (Process.GetCurrentProcess().PrivateMemorySize64 / (1024 * 1024)));

            if (Server.IsMonitoringCPUUsage)
            {
                player.Message("   Averaging {0:0.0}% CPU in last minute, {1:0.0}% CPU overall",
                               Server.CPUUsageLastMinute * 100,
                               Server.CPUUsageTotal * 100);
            }

            if (MonoCompat.IsMono)
            {
                player.Message("   Running fCraft {0}, under Mono {1}",
                               Updater.CurrentRelease.VersionString,
                               MonoCompat.MonoVersionString);
            }
            else
            {
                player.Message("   Running fCraft {0}, under .NET {1}",
                               Updater.CurrentRelease.VersionString,
                               Environment.Version);
            }

            double bytesReceivedRate = Server.PlayerList.Aggregate((double)0,
                                                                   (i, p) => i + p.Session.BytesReceivedRate);
            double bytesSentRate = Server.PlayerList.Aggregate((double)0,
                                                               (i, p) => i + p.Session.BytesSentRate);

            player.Message("   Upstream {0:0.0} KB/s, downstream {1:0.0} KB/s",
                           bytesSentRate / 1000, bytesReceivedRate / 1000);


            player.Message("   Database contains {0} players ({1} online, {2} banned, {3} IP-banned)",
                           PlayerDB.CountTotalPlayers(),
                           Server.CountVisiblePlayers(player),
                           PlayerDB.CountBannedPlayers(),
                           IPBanList.Count);

            player.Message("   There are {0} worlds available ({1} loaded)",
                           WorldManager.WorldList.Length,
                           WorldManager.CountLoadedWorlds(),
                           Server.CountVisiblePlayers(player));
        }