ProtocolVersion packet improvements.

This commit is contained in:
MobiusDevelopment
2019-11-21 11:21:20 +00:00
parent 1ff2b89dba
commit 61587c020a

View File

@@ -32,18 +32,25 @@ public class ProtocolVersion extends ClientBasePacket
{ {
super(rawPacket); super(rawPacket);
int version = readD(); int version = readD();
// _log.fine("Protocol Revision:" + version);
if (version != Config.CLIENT_PROTOCOL_VERSION) // this packet is never encrypted
if (version == -2)
{ {
_log.warning("Client " + client.getLoginName() + " tryied to login with client protocol " + version); // this is just a ping attempt from the client
throw new IOException("Wrong Protocol Version: " + version);
} }
else if (version != Config.CLIENT_PROTOCOL_VERSION)
{
_log.warning("Wrong Protocol Version: " + version + ", " + client);
}
else
{
Connection con = client.getConnection(); Connection con = client.getConnection();
KeyPacket pk = new KeyPacket(); KeyPacket pk = new KeyPacket();
pk.setKey(con.getCryptKey()); pk.setKey(con.getCryptKey());
con.sendPacket(pk); con.sendPacket(pk);
con.activateCryptKey(); con.activateCryptKey();
} }
}
@Override @Override
public String getType() public String getType()