mirror of
https://github.com/danbulant/flying-squid
synced 2026-07-06 11:40:46 +00:00
fix leaving : splice not slice !!
This commit is contained in:
parent
213fe7d84b
commit
8010ae86bd
1 changed files with 6 additions and 5 deletions
|
|
@ -181,17 +181,18 @@ function inject(serv,player)
|
||||||
|
|
||||||
player._client.on('end', function () {
|
player._client.on('end', function () {
|
||||||
serv.broadcast(player.username + ' quit the game.', "yellow");
|
serv.broadcast(player.username + ' quit the game.', "yellow");
|
||||||
player._writeOthers('player_info',{
|
player._writeOthers('player_info', {
|
||||||
action: 4,
|
action: 4,
|
||||||
data: [{
|
data: [{
|
||||||
UUID: transformUuid(player._client.uuid)
|
UUID: transformUuid(player._client.uuid)
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
player._writeOthers('entity_destroy',{'entityIds':[player.entity.id]});
|
player._writeOthers('entity_destroy', {'entityIds': [player.entity.id]});
|
||||||
player.emit('disconnect');
|
player.emit('disconnect');
|
||||||
var index=serv.players.indexOf(player);
|
var index = serv.players.indexOf(player);
|
||||||
if(index>-1)
|
if (index > -1) {
|
||||||
serv.players.slice(index,1);
|
serv.players.splice(index,1);
|
||||||
|
}
|
||||||
delete serv.uuidToPlayer[player._client.uuid];
|
delete serv.uuidToPlayer[player._client.uuid];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue