mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-11-19 02:00:38 +01:00
Pull ping from minecraft subqueries Fixes #233
This commit is contained in:
parent
e20bdf0ba7
commit
8496a523c3
1 changed files with 3 additions and 0 deletions
|
@ -61,6 +61,7 @@ class Minecraft extends Core {
|
|||
if (bedrockState.maxplayers) state.maxplayers = bedrockState.maxplayers;
|
||||
if (bedrockState.players.length) state.players = bedrockState.players;
|
||||
if (bedrockState.map) state.map = bedrockState.map;
|
||||
if (bedrockState.ping) state.ping = bedrockState.ping;
|
||||
}
|
||||
if (vanillaState) {
|
||||
try {
|
||||
|
@ -79,12 +80,14 @@ class Minecraft extends Core {
|
|||
} catch(e) {}
|
||||
if (vanillaState.maxplayers) state.maxplayers = vanillaState.maxplayers;
|
||||
if (vanillaState.players.length) state.players = vanillaState.players;
|
||||
if (vanillaState.ping) state.ping = vanillaState.ping;
|
||||
}
|
||||
if (gamespyState) {
|
||||
if (gamespyState.name) state.name = gamespyState.name;
|
||||
if (gamespyState.maxplayers) state.maxplayers = gamespyState.maxplayers;
|
||||
if (gamespyState.players.length) state.players = gamespyState.players;
|
||||
else if (gamespyState.raw.numplayers) state.players.setNum(parseInt(gamespyState.raw.numplayers));
|
||||
if (gamespyState.ping) state.ping = gamespyState.ping;
|
||||
}
|
||||
// remove dupe spaces from name
|
||||
state.name = state.name.replace(/\s+/g, ' ');
|
||||
|
|
Loading…
Reference in a new issue