mirror of
https://github.com/danbulant/flying-squid
synced 2026-07-07 04:00:46 +00:00
implement latency
This commit is contained in:
parent
c125221d5c
commit
95b5b57e72
2 changed files with 10 additions and 3 deletions
|
|
@ -27,7 +27,7 @@
|
||||||
"event-promise": "0.0.1",
|
"event-promise": "0.0.1",
|
||||||
"flatmap": "0.0.3",
|
"flatmap": "0.0.3",
|
||||||
"minecraft-data": "0.7.0",
|
"minecraft-data": "0.7.0",
|
||||||
"minecraft-protocol": "0.16.3",
|
"minecraft-protocol": "0.16.5",
|
||||||
"mkdirp": "0.5.1",
|
"mkdirp": "0.5.1",
|
||||||
"moment": "^2.10.6",
|
"moment": "^2.10.6",
|
||||||
"node-dir": "~0.1.9",
|
"node-dir": "~0.1.9",
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ module.exports.player=function(player,serv)
|
||||||
name: player.username,
|
name: player.username,
|
||||||
properties: player.profileProperties,
|
properties: player.profileProperties,
|
||||||
gamemode: player.gameMode,
|
gamemode: player.gameMode,
|
||||||
ping: 1
|
ping: player._client.latency
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -116,9 +116,16 @@ module.exports.player=function(player,serv)
|
||||||
name: otherPlayer.username,
|
name: otherPlayer.username,
|
||||||
properties: otherPlayer.profileProperties,
|
properties: otherPlayer.profileProperties,
|
||||||
gamemode: otherPlayer.gameMode,
|
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()
|
function announceJoin()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue