Implement helios-core and use Server List Ping protocol.
This commit is contained in:
@@ -4,7 +4,8 @@
|
||||
// Requirements
|
||||
const cp = require('child_process')
|
||||
const crypto = require('crypto')
|
||||
const {URL} = require('url')
|
||||
const { URL } = require('url')
|
||||
const { getServerStatus } = require('helios-core')
|
||||
|
||||
// Internal Requirements
|
||||
const DiscordWrapper = require('./assets/js/discordwrapper')
|
||||
@@ -225,11 +226,11 @@ const refreshServerStatus = async function(fade = false){
|
||||
|
||||
try {
|
||||
const serverURL = new URL('my://' + serv.getAddress())
|
||||
const servStat = await ServerStatus.getStatus(serverURL.hostname, serverURL.port)
|
||||
if(servStat.online){
|
||||
pLabel = 'PLAYERS'
|
||||
pVal = servStat.onlinePlayers + '/' + servStat.maxPlayers
|
||||
}
|
||||
|
||||
const servStat = await getServerStatus(47, serverURL.hostname, Number(serverURL.port))
|
||||
console.log(servStat)
|
||||
pLabel = 'PLAYERS'
|
||||
pVal = servStat.players.online + '/' + servStat.players.max
|
||||
|
||||
} catch (err) {
|
||||
loggerLanding.warn('Unable to refresh server status, assuming offline.')
|
||||
|
||||
@@ -85,7 +85,7 @@ bindFileSelectors()
|
||||
/**
|
||||
* Bind value validators to the settings UI elements. These will
|
||||
* validate against the criteria defined in the ConfigManager (if
|
||||
* and). If the value is invalid, the UI will reflect this and saving
|
||||
* any). If the value is invalid, the UI will reflect this and saving
|
||||
* will be disabled until the value is corrected. This is an automated
|
||||
* process. More complex UI may need to be bound separately.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user