当前位置: 首页>>代码示例>>Java>>正文


Java ServerStatusResponse.setProtocolVersionInfo方法代码示例

本文整理汇总了Java中net.minecraft.network.ServerStatusResponse.setProtocolVersionInfo方法的典型用法代码示例。如果您正苦于以下问题:Java ServerStatusResponse.setProtocolVersionInfo方法的具体用法?Java ServerStatusResponse.setProtocolVersionInfo怎么用?Java ServerStatusResponse.setProtocolVersionInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.network.ServerStatusResponse的用法示例。


在下文中一共展示了ServerStatusResponse.setProtocolVersionInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processServerQuery

import net.minecraft.network.ServerStatusResponse; //导入方法依赖的package包/类
@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));
}
 
开发者ID:NeptunePowered,项目名称:NeptuneCommon,代码行数:29,代码来源:MixinNetHandlerStatusServer.java

示例2: processServerQuery

import net.minecraft.network.ServerStatusResponse; //导入方法依赖的package包/类
/**
 * @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));
    }
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:39,代码来源:MixinNetHandlerStatusServer.java


注:本文中的net.minecraft.network.ServerStatusResponse.setProtocolVersionInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。