mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-28 05:35:56 -04:00
use bufferEqual instead of buffertools
native modules are annoying
This commit is contained in:
parent
a80765549c
commit
30fd138ae9
@ -128,13 +128,13 @@ srv.on('login', function(client) {
|
|||||||
client.compressionThreshold = data.threshold;
|
client.compressionThreshold = data.threshold;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var buffertools = require('buffertools');
|
var bufferEqual = require('buffer-equal');
|
||||||
targetClient.on('raw', function(buffer, meta) {
|
targetClient.on('raw', function(buffer, meta) {
|
||||||
if(client.state != states.PLAY || meta.state != states.PLAY)
|
if(client.state != states.PLAY || meta.state != states.PLAY)
|
||||||
return;
|
return;
|
||||||
var packetData = targetClient.deserializer.parsePacketData(buffer).data;
|
var packetData = targetClient.deserializer.parsePacketData(buffer).data;
|
||||||
var packetBuff = client.serializer.createPacketBuffer(meta.name, packetData);
|
var packetBuff = client.serializer.createPacketBuffer(meta.name, packetData);
|
||||||
if(buffertools.compare(buffer, packetBuff) != 0) {
|
if(!bufferEqual(buffer, packetBuff)) {
|
||||||
console.log("client<-server: Error in packet " + state + "." + meta.name);
|
console.log("client<-server: Error in packet " + state + "." + meta.name);
|
||||||
console.log(buffer.toString('hex'));
|
console.log(buffer.toString('hex'));
|
||||||
console.log(packetBuff.toString('hex'));
|
console.log(packetBuff.toString('hex'));
|
||||||
@ -154,7 +154,7 @@ srv.on('login', function(client) {
|
|||||||
return;
|
return;
|
||||||
var packetData = client.deserializer.parsePacketData(buffer).data;
|
var packetData = client.deserializer.parsePacketData(buffer).data;
|
||||||
var packetBuff = targetClient.serializer.createPacketBuffer(meta.name, packetData);
|
var packetBuff = targetClient.serializer.createPacketBuffer(meta.name, packetData);
|
||||||
if(buffertools.compare(buffer, packetBuff) != 0) {
|
if(!bufferEqual(buffer, packetBuff)) {
|
||||||
console.log("client->server: Error in packet " + state + "." + meta.name);
|
console.log("client->server: Error in packet " + state + "." + meta.name);
|
||||||
console.log(buffer.toString('hex'));
|
console.log(buffer.toString('hex'));
|
||||||
console.log(packetBuff.toString('hex'));
|
console.log(packetBuff.toString('hex'));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user