diff --git a/package.json b/package.json index 662b8be..cecd9d4 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "buffer-equal": "1.0.0", "minecraft-data": "^1.0.3", "prismarine-nbt": "0.2.1", - "protodef": "^1.0.0", + "protodef": "^1.0.1", "readable-stream": "^2.0.5", "ursa-purejs": "0.0.3", "uuid-1345": "^0.99.6", diff --git a/src/client.js b/src/client.js index 51b22d2..b08486f 100644 --- a/src/client.js +++ b/src/client.js @@ -58,6 +58,10 @@ class Client extends EventEmitter const serializerDirection = !this.isServer ? 'toServer' : 'toClient'; e.field = [this.protocolState, serializerDirection].concat(parts).join("."); e.message = `Serialization error for ${e.field} : ${e.message}`; + if(!this.compressor) + this.serializer.pipe(this.framer); + else + this.serializer.pipe(this.compressor); this.emit('error',e); }); @@ -68,6 +72,10 @@ class Client extends EventEmitter const deserializerDirection = this.isServer ? 'toServer' : 'toClient'; e.field = [this.protocolState, deserializerDirection].concat(parts).join("."); e.message = `Deserialization error for ${e.field} : ${e.message}`; + if(!this.compressor) + this.splitter.pipe(this.deserializer); + else + this.decompressor.pipe(this.deserializer); this.emit('error',e); });