MinecraftServer.java 文件源码

java
阅读 24 收藏 0 点赞 0 评论 0

项目:Backmemed 作者:
public void addServerStatsToSnooper(Snooper playerSnooper)
{
    playerSnooper.addClientStat("whitelist_enabled", Boolean.valueOf(false));
    playerSnooper.addClientStat("whitelist_count", Integer.valueOf(0));

    if (this.playerList != null)
    {
        playerSnooper.addClientStat("players_current", Integer.valueOf(this.getCurrentPlayerCount()));
        playerSnooper.addClientStat("players_max", Integer.valueOf(this.getMaxPlayers()));
        playerSnooper.addClientStat("players_seen", Integer.valueOf(this.playerList.getAvailablePlayerDat().length));
    }

    playerSnooper.addClientStat("uses_auth", Boolean.valueOf(this.onlineMode));
    playerSnooper.addClientStat("gui_state", this.getGuiEnabled() ? "enabled" : "disabled");
    playerSnooper.addClientStat("run_time", Long.valueOf((getCurrentTimeMillis() - playerSnooper.getMinecraftStartTimeMillis()) / 60L * 1000L));
    playerSnooper.addClientStat("avg_tick_ms", Integer.valueOf((int)(MathHelper.average(this.tickTimeArray) * 1.0E-6D)));
    int i = 0;

    if (this.worldServers != null)
    {
        for (WorldServer worldserver : this.worldServers)
        {
            if (worldserver != null)
            {
                WorldInfo worldinfo = worldserver.getWorldInfo();
                playerSnooper.addClientStat("world[" + i + "][dimension]", Integer.valueOf(worldserver.provider.getDimensionType().getId()));
                playerSnooper.addClientStat("world[" + i + "][mode]", worldinfo.getGameType());
                playerSnooper.addClientStat("world[" + i + "][difficulty]", worldserver.getDifficulty());
                playerSnooper.addClientStat("world[" + i + "][hardcore]", Boolean.valueOf(worldinfo.isHardcoreModeEnabled()));
                playerSnooper.addClientStat("world[" + i + "][generator_name]", worldinfo.getTerrainType().getWorldTypeName());
                playerSnooper.addClientStat("world[" + i + "][generator_version]", Integer.valueOf(worldinfo.getTerrainType().getGeneratorVersion()));
                playerSnooper.addClientStat("world[" + i + "][height]", Integer.valueOf(this.buildLimit));
                playerSnooper.addClientStat("world[" + i + "][chunks_loaded]", Integer.valueOf(worldserver.getChunkProvider().getLoadedChunkCount()));
                ++i;
            }
        }
    }

    playerSnooper.addClientStat("worlds", Integer.valueOf(i));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号