Cache the client status packet.

This commit is contained in:
md_5 2013-02-09 19:01:18 +11:00
parent b946e376c7
commit 9e2eda672d
3 changed files with 4 additions and 2 deletions

View File

@ -49,7 +49,7 @@ public class ServerConnection extends GenericConnection implements Server
PacketStream stream = new PacketStream( socket.getInputStream(), socket.getOutputStream() ); PacketStream stream = new PacketStream( socket.getInputStream(), socket.getOutputStream() );
stream.write( handshake ); stream.write( handshake );
stream.write( new PacketCDClientStatus( (byte) 0 ) ); stream.write( PacketCDClientStatus.CLIENT_LOGIN );
stream.readPacket(); stream.readPacket();
byte[] loginResponse = stream.readPacket(); byte[] loginResponse = stream.readPacket();

View File

@ -64,7 +64,7 @@ public abstract class DefinedPacket implements DataInput, DataOutput
*/ */
public byte[] getPacket() public byte[] getPacket()
{ {
return packet == null ? out.toByteArray() : packet; return packet == null ? packet = out.toByteArray() : packet;
} }
@Override @Override

View File

@ -8,6 +8,8 @@ import lombok.ToString;
public class PacketCDClientStatus extends DefinedPacket public class PacketCDClientStatus extends DefinedPacket
{ {
public static PacketCDClientStatus CLIENT_LOGIN = new PacketCDClientStatus( (byte) 0 );
/** /**
* Sent from the client to the server upon respawn, * Sent from the client to the server upon respawn,
* *