This commit is contained in:
Daniel Flanagan 2023-11-07 14:43:28 -06:00
parent 9904d770af
commit 2d38e11cc7
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4

View file

@ -48,9 +48,8 @@ function checkMinecraftServerStatus() {
cs.className = (status.online ? "na" : "err")
cs.textContent = status.online ? "ONLINE" : "OFFLINE"
const p = document.createElement("span")
p.style.marginLeft = "0.5em";
if (status.players) {
p.textContent = `(${status.players.online}/${status.players.max} players)`
p.textContent = ` with ${status.players.online}/${status.players.max} players`
if (status.players.online > 0 && status.players.list) {
pl = document.createElement("details")
pl.style.marginTop = "0"
@ -61,13 +60,14 @@ function checkMinecraftServerStatus() {
const plist = document.createElement("ul")
pl.appendChild(pld)
pl.appendChild(plist)
el.appendChild(pl)
for (let p of status.players.list) {
const pi = document.createElement("li")
pi.textContent = p.name
plist.appendChild(pi)
}
}
} else {
p.textContent = ` with ??/?? players`
}
el.replaceChildren(
s,