mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-29 06:03:33 -04:00
Add listener for compression request
This commit is contained in:
parent
cfa30d9e1d
commit
b73884e236
6
index.js
6
index.js
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user