Java 类net.minecraft.network.ServerStatusResponse 实例源码

项目:Resilience-Client-Source    文件:MinecraftServer.java   
private void func_147138_a(ServerStatusResponse p_147138_1_)
{
    File var2 = this.getFile("server-icon.png");

    if (var2.isFile())
    {
        ByteBuf var3 = Unpooled.buffer();

        try
        {
            BufferedImage var4 = ImageIO.read(var2);
            Validate.validState(var4.getWidth() == 64, "Must be 64 pixels wide", new Object[0]);
            Validate.validState(var4.getHeight() == 64, "Must be 64 pixels high", new Object[0]);
            ImageIO.write(var4, "PNG", new ByteBufOutputStream(var3));
            ByteBuf var5 = Base64.encode(var3);
            p_147138_1_.func_151320_a("data:image/png;base64," + var5.toString(Charsets.UTF_8));
        }
        catch (Exception var6)
        {
            logger.error("Couldn\'t load server icon", var6);
        }
    }
}
项目:DecompiledMinecraft    文件:MinecraftServer.java   
private void addFaviconToStatusResponse(ServerStatusResponse response)
{
    File file1 = this.getFile("server-icon.png");

    if (file1.isFile())
    {
        ByteBuf bytebuf = Unpooled.buffer();

        try
        {
            BufferedImage bufferedimage = ImageIO.read(file1);
            Validate.validState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide", new Object[0]);
            Validate.validState(bufferedimage.getHeight() == 64, "Must be 64 pixels high", new Object[0]);
            ImageIO.write(bufferedimage, "PNG", (OutputStream)(new ByteBufOutputStream(bytebuf)));
            ByteBuf bytebuf1 = Base64.encode(bytebuf);
            response.setFavicon("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
        }
        catch (Exception exception)
        {
            logger.error((String)"Couldn\'t load server icon", (Throwable)exception);
        }
        finally
        {
            bytebuf.release();
        }
    }
}
项目:DecompiledMinecraft    文件:MinecraftServer.java   
private void addFaviconToStatusResponse(ServerStatusResponse response)
{
    File file1 = this.getFile("server-icon.png");

    if (file1.isFile())
    {
        ByteBuf bytebuf = Unpooled.buffer();

        try
        {
            BufferedImage bufferedimage = ImageIO.read(file1);
            Validate.validState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide", new Object[0]);
            Validate.validState(bufferedimage.getHeight() == 64, "Must be 64 pixels high", new Object[0]);
            ImageIO.write(bufferedimage, "PNG", (OutputStream)(new ByteBufOutputStream(bytebuf)));
            ByteBuf bytebuf1 = Base64.encode(bytebuf);
            response.setFavicon("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
        }
        catch (Exception exception)
        {
            logger.error((String)"Couldn\'t load server icon", (Throwable)exception);
        }
        finally
        {
            bytebuf.release();
        }
    }
}
项目:BaseClient    文件:MinecraftServer.java   
private void addFaviconToStatusResponse(ServerStatusResponse response)
{
    File file1 = this.getFile("server-icon.png");

    if (file1.isFile())
    {
        ByteBuf bytebuf = Unpooled.buffer();

        try
        {
            BufferedImage bufferedimage = ImageIO.read(file1);
            Validate.validState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide", new Object[0]);
            Validate.validState(bufferedimage.getHeight() == 64, "Must be 64 pixels high", new Object[0]);
            ImageIO.write(bufferedimage, "PNG", (OutputStream)(new ByteBufOutputStream(bytebuf)));
            ByteBuf bytebuf1 = Base64.encode(bytebuf);
            response.setFavicon("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
        }
        catch (Exception exception)
        {
            logger.error((String)"Couldn\'t load server icon", (Throwable)exception);
        }
        finally
        {
            bytebuf.release();
        }
    }
}
项目:BaseClient    文件:MinecraftServer.java   
private void addFaviconToStatusResponse(ServerStatusResponse response)
{
    File file1 = this.getFile("server-icon.png");

    if (file1.isFile())
    {
        ByteBuf bytebuf = Unpooled.buffer();

        try
        {
            BufferedImage bufferedimage = ImageIO.read(file1);
            Validate.validState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide", new Object[0]);
            Validate.validState(bufferedimage.getHeight() == 64, "Must be 64 pixels high", new Object[0]);
            ImageIO.write(bufferedimage, "PNG", (OutputStream)(new ByteBufOutputStream(bytebuf)));
            ByteBuf bytebuf1 = Base64.encode(bytebuf);
            response.setFavicon("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
        }
        catch (Exception exception)
        {
            logger.error((String)"Couldn\'t load server icon", (Throwable)exception);
        }
        finally
        {
            bytebuf.release();
        }
    }
}
项目:Backmemed    文件:MinecraftServer.java   
public void applyServerIconToResponse(ServerStatusResponse response)
{
    File file1 = this.getFile("server-icon.png");

    if (!file1.exists())
    {
        file1 = this.getActiveAnvilConverter().getFile(this.getFolderName(), "icon.png");
    }

    if (file1.isFile())
    {
        ByteBuf bytebuf = Unpooled.buffer();

        try
        {
            BufferedImage bufferedimage = ImageIO.read(file1);
            Validate.validState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide", new Object[0]);
            Validate.validState(bufferedimage.getHeight() == 64, "Must be 64 pixels high", new Object[0]);
            ImageIO.write(bufferedimage, "PNG", (OutputStream)(new ByteBufOutputStream(bytebuf)));
            ByteBuf bytebuf1 = Base64.encode(bytebuf);
            response.setFavicon("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
        }
        catch (Exception exception)
        {
            LOG.error((String)"Couldn\'t load server icon", (Throwable)exception);
        }
        finally
        {
            bytebuf.release();
        }
    }
}
项目:CustomWorldGen    文件:FMLClientHandler.java   
public void captureAdditionalData(ServerStatusResponse serverstatusresponse, JsonObject jsonobject)
{
    if (jsonobject.has("modinfo"))
    {
        JsonObject fmlData = jsonobject.get("modinfo").getAsJsonObject();
        extraServerListData.put(serverstatusresponse, fmlData);
    }
}
项目:CustomWorldGen    文件:MinecraftServer.java   
public void applyServerIconToResponse(ServerStatusResponse response)
{
    File file1 = this.getFile("server-icon.png");

    if (!file1.exists())
    {
        file1 = this.getActiveAnvilConverter().getFile(this.getFolderName(), "icon.png");
    }

    if (file1.isFile())
    {
        ByteBuf bytebuf = Unpooled.buffer();

        try
        {
            BufferedImage bufferedimage = ImageIO.read(file1);
            Validate.validState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide", new Object[0]);
            Validate.validState(bufferedimage.getHeight() == 64, "Must be 64 pixels high", new Object[0]);
            ImageIO.write(bufferedimage, "PNG", (OutputStream)(new ByteBufOutputStream(bytebuf)));
            ByteBuf bytebuf1 = Base64.encode(bytebuf);
            response.setFavicon("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
        }
        catch (Exception exception)
        {
            LOG.error((String)"Couldn\'t load server icon", (Throwable)exception);
        }
        finally
        {
            bytebuf.release();
        }
    }
}
项目:TRHS_Club_Mod_2016    文件:FMLClientHandler.java   
public void captureAdditionalData(ServerStatusResponse serverstatusresponse, JsonObject jsonobject)
{
    if (jsonobject.has("modinfo"))
    {
        JsonObject fmlData = jsonobject.get("modinfo").getAsJsonObject();
        extraServerListData.put(serverstatusresponse, fmlData);
    }
}
项目:statusprotocol    文件:StatusProtocolImpl_1_8_9.java   
@Override
public OptionalInt getProtocolVersion(StatusResponse response) {
    if (response instanceof ServerStatusResponse) {
        return OptionalInt.of(((ServerStatusResponse) response).getProtocolVersionInfo().getProtocol());
    } else {
        return OptionalInt.empty();
    }
}
项目:statusprotocol    文件:StatusProtocolImpl_1_8_9.java   
@Override
public boolean setVersion(ClientPingServerEvent.Response response, String name, int protocol) {
    if (response instanceof ServerStatusResponse) {
        ((ServerStatusResponse) response).setProtocolVersionInfo(new ServerStatusResponse.MinecraftProtocolVersionIdentifier(name, protocol));
        return true;
    } else {
        return false;
    }
}
项目:statusprotocol    文件:StatusProtocolImpl_1_9.java   
@Override
public OptionalInt getProtocolVersion(StatusResponse response) {
    if (response instanceof ServerStatusResponse) {
        return OptionalInt.of(((ServerStatusResponse) response).getVersion().getProtocol());
    } else {
        return OptionalInt.empty();
    }
}
项目:statusprotocol    文件:StatusProtocolImpl_1_9.java   
@Override
public boolean setVersion(ClientPingServerEvent.Response response, String name, int protocol) {
    if (response instanceof ServerStatusResponse) {
        ((ServerStatusResponse) response).setVersion(new ServerStatusResponse.Version(name, protocol));
        return true;
    } else {
        return false;
    }
}
项目:LiteSpongeClient    文件:MixinServerStatusResponseSerializer.java   
@Inject(method = "deserialize", at = @At("RETURN"))
private void onDeserialize(JsonElement element, Type type, JsonDeserializationContext ctx, CallbackInfoReturnable<ServerStatusResponse> cir) {
    JsonObject json = element.getAsJsonObject();
    ServerStatusResponse response = cir.getReturnValue();

    ServerType serverType = null;
    ServerCompatibility serverCompat = null;

    if (json.has("spongeInfo")) {
        JsonObject spongeInfo = json.getAsJsonObject("spongeInfo");
        serverType = spongeInfo.has("serverType") ? ServerType.valueOf(spongeInfo.get("serverType").getAsString().toUpperCase()) : null;
        // Mainly means the server compatibility against the vanilla client
        serverCompat = spongeInfo.has("serverCompat") ? ServerCompatibility.valueOf(
                spongeInfo.get("serverCompat").getAsString().toUpperCase()) : null;
    }

    // System.out.println(new GsonBuilder().setPrettyPrinting().create().toJson(json.getAsJsonObject("modinfo")));

    if (serverType == null || serverCompat == null) {
        JsonObject modInfo = json.has("modinfo") ? json.getAsJsonObject("modinfo") : null;
        if (modInfo != null && modInfo.has("modList")) {
            List<String> mods = StreamSupport.stream(modInfo.getAsJsonArray("modList").spliterator(), false)
                    .map(e -> e.getAsJsonObject().get("modid").getAsString())
                    .collect(Collectors.toList());
            if (serverType == null) {
                if (mods.contains("sponge")) {
                    serverType = ServerType.SPONGE_FORGE;
                } else {
                    serverType = ServerType.FORGE;
                }
            }
        } else {
            if (serverCompat == null) {
                serverCompat = ServerCompatibility.UNKNOWN;
            }
        }
    }
    ((IMixinServerStatusResponse) response).setSpongeInfo(new SpongeStatusInfo(
            serverType == null ? ServerType.VANILLA : serverType, serverCompat == null ? ServerCompatibility.UNKNOWN : serverCompat));
}
项目:CauldronGit    文件:FMLClientHandler.java   
public void captureAdditionalData(ServerStatusResponse serverstatusresponse, JsonObject jsonobject)
{
    if (jsonobject.has("modinfo"))
    {
        JsonObject fmlData = jsonobject.get("modinfo").getAsJsonObject();
        extraServerListData.put(serverstatusresponse, fmlData);
    }
}
项目:NeptuneCommon    文件:MixinNetHandlerStatusServer.java   
@Overwrite
public void processServerQuery(C00PacketServerQuery packetIn) {
    ServerListPingHook hook =
            (ServerListPingHook) new ServerListPingHook((InetSocketAddress) networkManager.getRemoteAddress(),
                    ((IMixinNetworkManager) networkManager).getProtocolVersion(),
                    ((IMixinNetworkManager) networkManager).getHostnamePinged(),
                    ((IMixinNetworkManager) networkManager).getPortPinged(),
                    new NeptuneChatComponent(server.getServerStatusResponse().getServerDescription()),
                    server.getServerStatusResponse().getPlayerCountData().getOnlinePlayerCount(),
                    server.getServerStatusResponse().getPlayerCountData().getMaxPlayers(),
                    server.getServerStatusResponse().getFavicon(),
                    Arrays.asList(server.getServerStatusResponse().getPlayerCountData().getPlayers())).call();
    if (hook.isCanceled()) {
        networkManager.closeChannel(null);
        return;
    }

    ServerStatusResponse response = new ServerStatusResponse();
    response.setProtocolVersionInfo(server.getServerStatusResponse().getProtocolVersionInfo());
    ServerStatusResponse.PlayerCountData playerCountData = new ServerStatusResponse.PlayerCountData(hook
            .getMaxPlayers(), hook.getCurrentPlayers());
    playerCountData.setPlayers(hook.getProfiles().toArray(new GameProfile[hook.getProfiles().size()]));
    response.setPlayerCountData(playerCountData);
    response.setServerDescription(((NeptuneChatComponent) hook.getMotd()).getHandle());
    response.setFavicon(hook.getFavicon());

    networkManager.sendPacket(new S00PacketServerInfo(response));
}
项目:NeptuneMod    文件:MixinNetHandlerStatusServer.java   
/**
 * @author jamierocks - 5th May 2015
 * @reason Handle the ServerListPingHook
 */
@Overwrite
public void processServerQuery(C00PacketServerQuery packetIn) {
    if (handled) {
        this.networkManager.closeChannel(EXIT_MESSAGE);
    } else {
        this.handled = true;

        ServerListPingHook hook =
                (ServerListPingHook) new ServerListPingHook((InetSocketAddress) this.networkManager.getRemoteAddress(),
                        ((IMixinNetworkManager) this.networkManager).getProtocolVersion(),
                        ((IMixinNetworkManager) this.networkManager).getHostnamePinged(),
                        ((IMixinNetworkManager) this.networkManager).getPortPinged(),
                        (ChatComponent) this.server.getServerStatusResponse().getServerDescription(),
                        this.server.getServerStatusResponse().getPlayerCountData().getOnlinePlayerCount(),
                        this.server.getServerStatusResponse().getPlayerCountData().getMaxPlayers(),
                        this.server.getServerStatusResponse().getFavicon(),
                        Arrays.asList(this.server.getServerStatusResponse().getPlayerCountData().getPlayers())).call();
        if (hook.isCanceled()) {
            this.networkManager.closeChannel(null);
            return;
        }

        ServerStatusResponse response = new ServerStatusResponse();
        response.setProtocolVersionInfo(this.server.getServerStatusResponse().getProtocolVersionInfo());
        ServerStatusResponse.PlayerCountData playerCountData = new ServerStatusResponse.PlayerCountData(hook
                .getMaxPlayers(), hook.getCurrentPlayers());
        playerCountData.setPlayers(hook.getProfiles().toArray(new GameProfile[hook.getProfiles().size()]));
        response.setPlayerCountData(playerCountData);
        response.setServerDescription((IChatComponent) hook.getMotd());
        response.setFavicon(hook.getFavicon());

        this.networkManager.sendPacket(new S00PacketServerInfo(response));
    }
}
项目:Cauldron    文件:FMLClientHandler.java   
public void captureAdditionalData(ServerStatusResponse serverstatusresponse, JsonObject jsonobject)
{
    if (jsonobject.has("modinfo"))
    {
        JsonObject fmlData = jsonobject.get("modinfo").getAsJsonObject();
        extraServerListData.put(serverstatusresponse, fmlData);
    }
}
项目:Cauldron    文件:FMLClientHandler.java   
public void captureAdditionalData(ServerStatusResponse serverstatusresponse, JsonObject jsonobject)
{
    if (jsonobject.has("modinfo"))
    {
        JsonObject fmlData = jsonobject.get("modinfo").getAsJsonObject();
        extraServerListData.put(serverstatusresponse, fmlData);
    }
}
项目:Cauldron    文件:MinecraftServer.java   
private void func_147138_a(ServerStatusResponse p_147138_1_)
{
    File file1 = this.getFile("server-icon.png");

    if (file1.isFile())
    {
        ByteBuf bytebuf = Unpooled.buffer();

        try
        {
            BufferedImage bufferedimage = ImageIO.read(file1);
            Validate.validState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide", new Object[0]);
            Validate.validState(bufferedimage.getHeight() == 64, "Must be 64 pixels high", new Object[0]);
            ImageIO.write(bufferedimage, "PNG", new ByteBufOutputStream(bytebuf));
            ByteBuf bytebuf1 = Base64.encode(bytebuf);
            p_147138_1_.func_151320_a("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
        }
        catch (Exception exception)
        {
            logger.error("Couldn\'t load server icon", exception);
        }
        finally
        {
            bytebuf.release();
        }
    }
}
项目:Cauldron    文件:FMLClientHandler.java   
public void captureAdditionalData(ServerStatusResponse serverstatusresponse, JsonObject jsonobject)
{
    if (jsonobject.has("modinfo"))
    {
        JsonObject fmlData = jsonobject.get("modinfo").getAsJsonObject();
        extraServerListData.put(serverstatusresponse, fmlData);
    }
}
项目:Cauldron    文件:MinecraftServer.java   
private void func_147138_a(ServerStatusResponse p_147138_1_)
{
    File file1 = this.getFile("server-icon.png");

    if (file1.isFile())
    {
        ByteBuf bytebuf = Unpooled.buffer();

        try
        {
            BufferedImage bufferedimage = ImageIO.read(file1);
            Validate.validState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide", new Object[0]);
            Validate.validState(bufferedimage.getHeight() == 64, "Must be 64 pixels high", new Object[0]);
            ImageIO.write(bufferedimage, "PNG", new ByteBufOutputStream(bytebuf));
            ByteBuf bytebuf1 = Base64.encode(bytebuf);
            p_147138_1_.func_151320_a("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
        }
        catch (Exception exception)
        {
            logger.error("Couldn\'t load server icon", exception);
        }
        finally
        {
            bytebuf.release();
        }
    }
}
项目:DecompiledMinecraft    文件:S00PacketServerInfo.java   
public S00PacketServerInfo(ServerStatusResponse responseIn)
{
    this.response = responseIn;
}
项目:DecompiledMinecraft    文件:S00PacketServerInfo.java   
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer buf) throws IOException
{
    this.response = (ServerStatusResponse)GSON.fromJson(buf.readStringFromBuffer(32767), ServerStatusResponse.class);
}
项目:DecompiledMinecraft    文件:MinecraftServer.java   
/**
 * Main function called by run() every loop.
 */
protected void tick()
{
    long i = System.nanoTime();
    ++this.tickCounter;

    if (this.startProfiling)
    {
        this.startProfiling = false;
        this.theProfiler.profilingEnabled = true;
        this.theProfiler.clearProfiling();
    }

    this.theProfiler.startSection("root");
    this.updateTimeLightAndEntities();

    if (i - this.nanoTimeSinceStatusRefresh >= 5000000000L)
    {
        this.nanoTimeSinceStatusRefresh = i;
        this.statusResponse.setPlayerCountData(new ServerStatusResponse.PlayerCountData(this.getMaxPlayers(), this.getCurrentPlayerCount()));
        GameProfile[] agameprofile = new GameProfile[Math.min(this.getCurrentPlayerCount(), 12)];
        int j = MathHelper.getRandomIntegerInRange(this.random, 0, this.getCurrentPlayerCount() - agameprofile.length);

        for (int k = 0; k < agameprofile.length; ++k)
        {
            agameprofile[k] = ((EntityPlayerMP)this.serverConfigManager.func_181057_v().get(j + k)).getGameProfile();
        }

        Collections.shuffle(Arrays.asList(agameprofile));
        this.statusResponse.getPlayerCountData().setPlayers(agameprofile);
    }

    if (this.tickCounter % 900 == 0)
    {
        this.theProfiler.startSection("save");
        this.serverConfigManager.saveAllPlayerData();
        this.saveAllWorlds(true);
        this.theProfiler.endSection();
    }

    this.theProfiler.startSection("tallying");
    this.tickTimeArray[this.tickCounter % 100] = System.nanoTime() - i;
    this.theProfiler.endSection();
    this.theProfiler.startSection("snooper");

    if (!this.usageSnooper.isSnooperRunning() && this.tickCounter > 100)
    {
        this.usageSnooper.startSnooper();
    }

    if (this.tickCounter % 6000 == 0)
    {
        this.usageSnooper.addMemoryStatsToSnooper();
    }

    this.theProfiler.endSection();
    this.theProfiler.endSection();
}
项目:DecompiledMinecraft    文件:MinecraftServer.java   
public ServerStatusResponse getServerStatusResponse()
{
    return this.statusResponse;
}
项目:DecompiledMinecraft    文件:S00PacketServerInfo.java   
public S00PacketServerInfo(ServerStatusResponse responseIn)
{
    this.response = responseIn;
}
项目:DecompiledMinecraft    文件:S00PacketServerInfo.java   
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer buf) throws IOException
{
    this.response = (ServerStatusResponse)GSON.fromJson(buf.readStringFromBuffer(32767), ServerStatusResponse.class);
}
项目:DecompiledMinecraft    文件:S00PacketServerInfo.java   
public ServerStatusResponse getResponse()
{
    return this.response;
}
项目:DecompiledMinecraft    文件:MinecraftServer.java   
/**
 * Main function called by run() every loop.
 */
public void tick()
{
    long i = System.nanoTime();
    ++this.tickCounter;

    if (this.startProfiling)
    {
        this.startProfiling = false;
        this.theProfiler.profilingEnabled = true;
        this.theProfiler.clearProfiling();
    }

    this.theProfiler.startSection("root");
    this.updateTimeLightAndEntities();

    if (i - this.nanoTimeSinceStatusRefresh >= 5000000000L)
    {
        this.nanoTimeSinceStatusRefresh = i;
        this.statusResponse.setPlayerCountData(new ServerStatusResponse.PlayerCountData(this.getMaxPlayers(), this.getCurrentPlayerCount()));
        GameProfile[] agameprofile = new GameProfile[Math.min(this.getCurrentPlayerCount(), 12)];
        int j = MathHelper.getRandomIntegerInRange(this.random, 0, this.getCurrentPlayerCount() - agameprofile.length);

        for (int k = 0; k < agameprofile.length; ++k)
        {
            agameprofile[k] = ((EntityPlayerMP)this.serverConfigManager.func_181057_v().get(j + k)).getGameProfile();
        }

        Collections.shuffle(Arrays.asList(agameprofile));
        this.statusResponse.getPlayerCountData().setPlayers(agameprofile);
    }

    if (this.tickCounter % 900 == 0)
    {
        this.theProfiler.startSection("save");
        this.serverConfigManager.saveAllPlayerData();
        this.saveAllWorlds(true);
        this.theProfiler.endSection();
    }

    this.theProfiler.startSection("tallying");
    this.tickTimeArray[this.tickCounter % 100] = System.nanoTime() - i;
    this.theProfiler.endSection();
    this.theProfiler.startSection("snooper");

    if (!this.usageSnooper.isSnooperRunning() && this.tickCounter > 100)
    {
        this.usageSnooper.startSnooper();
    }

    if (this.tickCounter % 6000 == 0)
    {
        this.usageSnooper.addMemoryStatsToSnooper();
    }

    this.theProfiler.endSection();
    this.theProfiler.endSection();
}
项目:DecompiledMinecraft    文件:MinecraftServer.java   
public ServerStatusResponse getServerStatusResponse()
{
    return this.statusResponse;
}
项目:BaseClient    文件:S00PacketServerInfo.java   
public S00PacketServerInfo(ServerStatusResponse responseIn)
{
    this.response = responseIn;
}
项目:BaseClient    文件:S00PacketServerInfo.java   
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer buf) throws IOException
{
    this.response = (ServerStatusResponse)GSON.fromJson(buf.readStringFromBuffer(32767), ServerStatusResponse.class);
}
项目:BaseClient    文件:S00PacketServerInfo.java   
public ServerStatusResponse getResponse()
{
    return this.response;
}
项目:BaseClient    文件:MinecraftServer.java   
/**
 * Main function called by run() every loop.
 */
public void tick()
{
    long i = System.nanoTime();
    ++this.tickCounter;

    if (this.startProfiling)
    {
        this.startProfiling = false;
        this.theProfiler.profilingEnabled = true;
        this.theProfiler.clearProfiling();
    }

    this.theProfiler.startSection("root");
    this.updateTimeLightAndEntities();

    if (i - this.nanoTimeSinceStatusRefresh >= 5000000000L)
    {
        this.nanoTimeSinceStatusRefresh = i;
        this.statusResponse.setPlayerCountData(new ServerStatusResponse.PlayerCountData(this.getMaxPlayers(), this.getCurrentPlayerCount()));
        GameProfile[] agameprofile = new GameProfile[Math.min(this.getCurrentPlayerCount(), 12)];
        int j = MathHelper.getRandomIntegerInRange(this.random, 0, this.getCurrentPlayerCount() - agameprofile.length);

        for (int k = 0; k < agameprofile.length; ++k)
        {
            agameprofile[k] = ((EntityPlayerMP)this.serverConfigManager.func_181057_v().get(j + k)).getGameProfile();
        }

        Collections.shuffle(Arrays.asList(agameprofile));
        this.statusResponse.getPlayerCountData().setPlayers(agameprofile);
    }

    if (this.tickCounter % 900 == 0)
    {
        this.theProfiler.startSection("save");
        this.serverConfigManager.saveAllPlayerData();
        this.saveAllWorlds(true);
        this.theProfiler.endSection();
    }

    this.theProfiler.startSection("tallying");
    this.tickTimeArray[this.tickCounter % 100] = System.nanoTime() - i;
    this.theProfiler.endSection();
    this.theProfiler.startSection("snooper");

    if (!this.usageSnooper.isSnooperRunning() && this.tickCounter > 100)
    {
        this.usageSnooper.startSnooper();
    }

    if (this.tickCounter % 6000 == 0)
    {
        this.usageSnooper.addMemoryStatsToSnooper();
    }

    this.theProfiler.endSection();
    this.theProfiler.endSection();
}
项目:BaseClient    文件:MinecraftServer.java   
public ServerStatusResponse getServerStatusResponse()
{
    return this.statusResponse;
}
项目:BaseClient    文件:S00PacketServerInfo.java   
public S00PacketServerInfo(ServerStatusResponse responseIn)
{
    this.response = responseIn;
}
项目:BaseClient    文件:S00PacketServerInfo.java   
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer buf) throws IOException
{
    this.response = (ServerStatusResponse)GSON.fromJson(buf.readStringFromBuffer(32767), ServerStatusResponse.class);
}
项目:BaseClient    文件:S00PacketServerInfo.java   
public ServerStatusResponse getResponse()
{
    return this.response;
}
项目:BaseClient    文件:MinecraftServer.java   
/**
 * Main function called by run() every loop.
 */
public void tick()
{
    long i = System.nanoTime();
    ++this.tickCounter;

    if (this.startProfiling)
    {
        this.startProfiling = false;
        this.theProfiler.profilingEnabled = true;
        this.theProfiler.clearProfiling();
    }

    this.theProfiler.startSection("root");
    this.updateTimeLightAndEntities();

    if (i - this.nanoTimeSinceStatusRefresh >= 5000000000L)
    {
        this.nanoTimeSinceStatusRefresh = i;
        this.statusResponse.setPlayerCountData(new ServerStatusResponse.PlayerCountData(this.getMaxPlayers(), this.getCurrentPlayerCount()));
        GameProfile[] agameprofile = new GameProfile[Math.min(this.getCurrentPlayerCount(), 12)];
        int j = MathHelper.getRandomIntegerInRange(this.random, 0, this.getCurrentPlayerCount() - agameprofile.length);

        for (int k = 0; k < agameprofile.length; ++k)
        {
            agameprofile[k] = ((EntityPlayerMP)this.serverConfigManager.func_181057_v().get(j + k)).getGameProfile();
        }

        Collections.shuffle(Arrays.asList(agameprofile));
        this.statusResponse.getPlayerCountData().setPlayers(agameprofile);
    }

    if (this.tickCounter % 900 == 0)
    {
        this.theProfiler.startSection("save");
        this.serverConfigManager.saveAllPlayerData();
        this.saveAllWorlds(true);
        this.theProfiler.endSection();
    }

    this.theProfiler.startSection("tallying");
    this.tickTimeArray[this.tickCounter % 100] = System.nanoTime() - i;
    this.theProfiler.endSection();
    this.theProfiler.startSection("snooper");

    if (!this.usageSnooper.isSnooperRunning() && this.tickCounter > 100)
    {
        this.usageSnooper.startSnooper();
    }

    if (this.tickCounter % 6000 == 0)
    {
        this.usageSnooper.addMemoryStatsToSnooper();
    }

    this.theProfiler.endSection();
    this.theProfiler.endSection();
}