@Override public IThreadListener getWorldThread(INetHandler net) { if (net instanceof INetHandlerPlayClient || net instanceof INetHandlerLoginClient || net instanceof INetHandlerStatusClient) return getClient(); if (net instanceof INetHandlerHandshakeServer || net instanceof INetHandlerLoginServer || net instanceof INetHandlerPlayServer || net instanceof INetHandlerStatusServer) return getServer(); throw new RuntimeException("Unknown INetHandler: " + net); }
/** * Passes this Packet on to the NetHandler for processing. */ public void processPacket(INetHandlerStatusClient handler) { handler.handlePong(this); }
/** * Passes this Packet on to the NetHandler for processing. */ public void processPacket(INetHandlerStatusClient handler) { handler.handleServerInfo(this); }
public void processPacket(INetHandlerStatusClient p_149291_1_) { p_149291_1_.handlePong(this); }
public void processPacket(INetHandler p_148833_1_) { this.processPacket((INetHandlerStatusClient)p_148833_1_); }
public void processPacket(INetHandlerStatusClient p_149295_1_) { p_149295_1_.handleServerInfo(this); }
public void processPacket(INetHandlerStatusClient p_148833_1_) { p_148833_1_.handlePong(this); }
public void processPacket(INetHandlerStatusClient p_148833_1_) { p_148833_1_.handleServerInfo(this); }
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); } } }