public void processServerQuery(C00PacketServerQuery packetIn) { if (this.field_183008_d) { this.networkManager.closeChannel(field_183007_a); } else { this.field_183008_d = true; this.networkManager.sendPacket(new S00PacketServerInfo(this.server.getServerStatusResponse())); } }
@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)); }
/** * @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)); } }
public void processServerQuery(C00PacketServerQuery p_147312_1_) { this.field_147313_b.scheduleOutboundPacket(new S00PacketServerInfo(this.field_147314_a.func_147134_at()), new GenericFutureListener[0]); }
public void pingServer(final String p_pingServer_1_, final ServerPing p_pingServer_2_) throws IOException { if (p_pingServer_1_ != null && !p_pingServer_1_.startsWith("0.0.0.0") && !p_pingServer_1_.isEmpty()) { RealmsServerAddress realmsserveraddress = RealmsServerAddress.parseString(p_pingServer_1_); final NetworkManager networkmanager = NetworkManager.provideLanClient(InetAddress.getByName(realmsserveraddress.getHost()), realmsserveraddress.getPort()); this.connections.add(networkmanager); networkmanager.setNetHandler(new INetHandlerStatusClient() { private boolean field_154345_e = false; private static final String __OBFID = "CL_00001807"; public void handleServerInfo(S00PacketServerInfo p_147397_1_) { ServerStatusResponse serverstatusresponse = p_147397_1_.func_149294_c(); if (serverstatusresponse.func_151318_b() != null) { p_pingServer_2_.nrOfPlayers = String.valueOf(serverstatusresponse.func_151318_b().func_151333_b()); } networkmanager.scheduleOutboundPacket(new C01PacketPing(Realms.currentTimeMillis()), new GenericFutureListener[0]); this.field_154345_e = true; } public void handlePong(S01PacketPong p_147398_1_) { networkmanager.closeChannel(new ChatComponentText("Finished")); } public void onDisconnect(IChatComponent p_147231_1_) { if (!this.field_154345_e) { RealmsServerStatusPinger.LOGGER.error("Can\'t ping " + p_pingServer_1_ + ": " + p_147231_1_.getUnformattedText()); } } public void onConnectionStateTransition(EnumConnectionState p_147232_1_, EnumConnectionState p_147232_2_) { if (p_147232_2_ != EnumConnectionState.STATUS) { throw new UnsupportedOperationException("Unexpected change in protocol to " + p_147232_2_); } } public void onNetworkTick() {} }); try { networkmanager.scheduleOutboundPacket(new C00Handshake(RealmsSharedConstants.NETWORK_PROTOCOL_VERSION, realmsserveraddress.getHost(), realmsserveraddress.getPort(), EnumConnectionState.STATUS), new GenericFutureListener[0]); networkmanager.scheduleOutboundPacket(new C00PacketServerQuery(), new GenericFutureListener[0]); } catch (Throwable throwable) { LOGGER.error(throwable); } } }
@Override public Class<? extends Packet> getPacket() { // TODO Auto-generated method stub return S00PacketServerInfo.class; }
void handleServerInfo(S00PacketServerInfo packetIn);
void handleServerInfo(S00PacketServerInfo var1);
void handleServerInfo(S00PacketServerInfo p_147397_1_);