Add listener for compression request

This commit is contained in:
Will Franzen 2014-12-30 02:15:08 -06:00
parent cfa30d9e1d
commit b73884e236

View file

@ -141,6 +141,8 @@ function createServer(options) {
hash = crypto.createHash("sha1");
hash.update(serverId);
client.once([states.LOGIN, 0x01], onEncryptionKeyResponse);
client.once([states.LOGIN, 0x03], onCompressionRequest);
client.on( [states.PLAY, 0x46], onCompressionRequest);
client.write(0x01, {
serverId: serverId,
publicKey: client.publicKey,
@ -193,6 +195,10 @@ function createServer(options) {
}
}
function onCompressionRequest(packet) {
client.compressionThreshold = packet.threshold;
}
function loginClient() {
var isException = !!server.onlineModeExceptions[client.username.toLowerCase()];
if (onlineMode == false || isException) {