mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-11-29 18:55:40 -05:00
Add listener for compression request
This commit is contained in:
parent
cfa30d9e1d
commit
b73884e236
1 changed files with 6 additions and 0 deletions
6
index.js
6
index.js
|
@ -141,6 +141,8 @@ function createServer(options) {
|
||||||
hash = crypto.createHash("sha1");
|
hash = crypto.createHash("sha1");
|
||||||
hash.update(serverId);
|
hash.update(serverId);
|
||||||
client.once([states.LOGIN, 0x01], onEncryptionKeyResponse);
|
client.once([states.LOGIN, 0x01], onEncryptionKeyResponse);
|
||||||
|
client.once([states.LOGIN, 0x03], onCompressionRequest);
|
||||||
|
client.on( [states.PLAY, 0x46], onCompressionRequest);
|
||||||
client.write(0x01, {
|
client.write(0x01, {
|
||||||
serverId: serverId,
|
serverId: serverId,
|
||||||
publicKey: client.publicKey,
|
publicKey: client.publicKey,
|
||||||
|
@ -193,6 +195,10 @@ function createServer(options) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onCompressionRequest(packet) {
|
||||||
|
client.compressionThreshold = packet.threshold;
|
||||||
|
}
|
||||||
|
|
||||||
function loginClient() {
|
function loginClient() {
|
||||||
var isException = !!server.onlineModeExceptions[client.username.toLowerCase()];
|
var isException = !!server.onlineModeExceptions[client.username.toLowerCase()];
|
||||||
if (onlineMode == false || isException) {
|
if (onlineMode == false || isException) {
|
||||||
|
|
Loading…
Reference in a new issue