mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-11-14 19:04:59 -05:00
Fix error in example (#701)
* Fix error in example This fixes an error that occurs with the example echo client: ```TypeError [ERR_INVALID_ARG_TYPE]: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received an instance of Object``` This change might be needed in the server as well, but I didn't test that. Or maybe there's a better way to fix this * Fix Browserify and Webpack * Actually fix Browserify/Webpack * ACTUALLY actually fix Browserify/Webpack * Surely this will fix Browserify/Webpack
This commit is contained in:
parent
28b52a9158
commit
bba58c8d28
2 changed files with 2 additions and 2 deletions
|
@ -70,7 +70,7 @@ client.on('chat', function(packet) {
|
||||||
var username = jsonMsg.with[0].text;
|
var username = jsonMsg.with[0].text;
|
||||||
var msg = jsonMsg.with[1];
|
var msg = jsonMsg.with[1];
|
||||||
if(username === client.username) return;
|
if(username === client.username) return;
|
||||||
client.write('chat', {message: msg});
|
client.write('chat', {message: msg.text});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
|
@ -52,7 +52,7 @@ class Decompressor extends Transform {
|
||||||
this.push(chunk.slice(size))
|
this.push(chunk.slice(size))
|
||||||
return cb()
|
return cb()
|
||||||
} else {
|
} else {
|
||||||
zlib.unzip(chunk.slice(size), { finishFlush: zlib.constants.Z_SYNC_FLUSH }, (err, newBuf) => { /** Fix by lefela4. */
|
zlib.unzip(chunk.slice(size), { finishFlush: 2 /* Z_SYNC_FLUSH = 2, but when using Browserify/Webpack it doesn't exist */ }, (err, newBuf) => { /** Fix by lefela4. */
|
||||||
if (err) {
|
if (err) {
|
||||||
if (!this.hideErrors) {
|
if (!this.hideErrors) {
|
||||||
console.error('problem inflating chunk')
|
console.error('problem inflating chunk')
|
||||||
|
|
Loading…
Reference in a new issue