本文整理汇总了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));
}
示例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));
}
}