Implement helios-core and use Server List Ping protocol.

This commit is contained in:
Daniel Scalzi
2021-10-31 02:20:03 -04:00
parent a2168da999
commit 9c6d75f812
5 changed files with 5361 additions and 792 deletions

View File

@@ -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.')

View File

@@ -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.
*/