implement latency

This commit is contained in:
Romain Beaumont 2015-12-22 00:28:50 +01:00
parent c125221d5c
commit 95b5b57e72
2 changed files with 10 additions and 3 deletions

View file

@ -27,7 +27,7 @@
"event-promise": "0.0.1",
"flatmap": "0.0.3",
"minecraft-data": "0.7.0",
"minecraft-protocol": "0.16.3",
"minecraft-protocol": "0.16.5",
"mkdirp": "0.5.1",
"moment": "^2.10.6",
"node-dir": "~0.1.9",

View file

@ -105,7 +105,7 @@ module.exports.player=function(player,serv)
name: player.username,
properties: player.profileProperties,
gamemode: player.gameMode,
ping: 1
ping: player._client.latency
}]
});
@ -116,9 +116,16 @@ module.exports.player=function(player,serv)
name: otherPlayer.username,
properties: otherPlayer.profileProperties,
gamemode: otherPlayer.gameMode,
ping: 1
ping: otherPlayer._client.latency
}))
});
setInterval(() => player._client.write('player_info',{
action:2,
data:serv.players.map(otherPlayer => ({
UUID: otherPlayer._client.uuid,
ping:otherPlayer._client.latency
}))
}),5000);
}
function announceJoin()