mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-29 06:03:33 -04:00
commit
c9b6ad8dbe
@ -25,6 +25,7 @@ Server.prototype.listen = function(port, host) {
|
|||||||
var client = new Client(true);
|
var client = new Client(true);
|
||||||
client._end = client.end;
|
client._end = client.end;
|
||||||
client.end = function end(endReason) {
|
client.end = function end(endReason) {
|
||||||
|
endReason='{"text":"'+endReason+'"}';
|
||||||
if(client.state === states.PLAY) {
|
if(client.state === states.PLAY) {
|
||||||
client.write('kick_disconnect', {reason: endReason});
|
client.write('kick_disconnect', {reason: endReason});
|
||||||
} else if(client.state === states.LOGIN) {
|
} else if(client.state === states.LOGIN) {
|
||||||
|
@ -439,7 +439,7 @@ describe("client", function() {
|
|||||||
});
|
});
|
||||||
var gotKicked = false;
|
var gotKicked = false;
|
||||||
client.on([states.LOGIN, 0x00], function(packet) {
|
client.on([states.LOGIN, 0x00], function(packet) {
|
||||||
assert.strictEqual(packet.reason, '"Failed to verify username!"');
|
assert.ok(packet.reason.indexOf('"Failed to verify username!"')!=-1);
|
||||||
gotKicked = true;
|
gotKicked = true;
|
||||||
});
|
});
|
||||||
client.on('end', function() {
|
client.on('end', function() {
|
||||||
@ -498,7 +498,7 @@ describe("mc-server", function() {
|
|||||||
var count = 2;
|
var count = 2;
|
||||||
server.on('connection', function(client) {
|
server.on('connection', function(client) {
|
||||||
client.on('end', function(reason) {
|
client.on('end', function(reason) {
|
||||||
assert.strictEqual(reason, "LoginTimeout");
|
assert.strictEqual(reason, '{"text":"LoginTimeout"}');
|
||||||
server.close();
|
server.close();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -527,7 +527,7 @@ describe("mc-server", function() {
|
|||||||
var count = 2;
|
var count = 2;
|
||||||
server.on('connection', function(client) {
|
server.on('connection', function(client) {
|
||||||
client.on('end', function(reason) {
|
client.on('end', function(reason) {
|
||||||
assert.strictEqual(reason, "KeepAliveTimeout");
|
assert.strictEqual(reason, '{"text":"KeepAliveTimeout"}');
|
||||||
server.close();
|
server.close();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -682,7 +682,7 @@ describe("mc-server", function() {
|
|||||||
var count = 2;
|
var count = 2;
|
||||||
server.on('login', function(client) {
|
server.on('login', function(client) {
|
||||||
client.on('end', function(reason) {
|
client.on('end', function(reason) {
|
||||||
assert.strictEqual(reason, 'ServerShutdown');
|
assert.strictEqual(reason, '{"text":"ServerShutdown"}');
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
client.write('login', {
|
client.write('login', {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user