/** * Handles the Forge packet. * * @param message The Forge Handshake packet to handle. */ public void handle(PluginMessage message) throws IllegalArgumentException { if ( !message.getTag().equalsIgnoreCase( ForgeConstants.FML_HANDSHAKE_TAG ) ) { throw new IllegalArgumentException( "Expecting a Forge Handshake packet." ); } message.setAllowExtendedPacket( true ); // FML allows extended packets so this must be enabled ForgeClientHandshakeState prevState = state; Preconditions.checkState( packetQueue.size() < 128, "Forge packet queue too big!" ); packetQueue.add( message ); state = state.send( message, con ); if ( state != prevState ) // state finished, send packets { synchronized ( packetQueue ) { while ( !packetQueue.isEmpty() ) { ForgeLogger.logClient( ForgeLogger.LogDirection.SENDING, prevState.name(), packetQueue.getFirst() ); con.getForgeServerHandler().receive( packetQueue.removeFirst() ); } } } }
/** * Handles the Forge packet. * * @param message The Forge Handshake packet to handle. */ public void handle(PluginMessage message) throws IllegalArgumentException { if ( !message.getTag().equalsIgnoreCase( ForgeConstants.FML_HANDSHAKE_TAG ) ) { throw new IllegalArgumentException( "Expecting a Forge Handshake packet." ); } message.setAllowExtendedPacket( true ); // FML allows extended packets so this must be enabled ForgeClientHandshakeState prevState = state; packetQueue.add( message ); state = state.send( message, con ); if ( state != prevState ) // state finished, send packets { synchronized ( packetQueue ) { while ( !packetQueue.isEmpty() ) { ForgeLogger.logClient( ForgeLogger.LogDirection.SENDING, prevState.name(), packetQueue.getFirst() ); con.getForgeServerHandler().receive( packetQueue.removeFirst() ); } } } }