Closed Conanap closed 1 year ago
Thank you for reaching out, @Conanap. I just tested against a Minecraft server running version 1.4.7 with the ternary operator using nodejs
v12.22.12. This test was also using the latest minestat.js
code from master. I am unable to replicate your findings. See the screenshots below for details. The first instance of "Online" is while the server is running. The "Offline" output that follows is after I terminate the Minecraft server.
Is the variable's value or the result possibly cached in your webserver application (or browser) somehow?
Hey, thanks for the quick reply! I've refreshed the broswer as well and clear cache, but couldn't seem to get it to show as offline. The site makes a request for the updated status to the server every 10 seconds, and in the networking tab I can see that the response is "online" as well
Perhaps the server version may be the issue? Is there support for 1.19.x? Thanks!
After some discussion and testing with @mindsolve, it turns out that this is a bug if the interpreter is run interactively/persistently. The interpreter retains the true
value until it exits (or the variable is explicitly reset). We have a small fix that I'll be pushing soon.
PR #131 has been submitted as a fix. Please let us know if that resolves your issue, @Conanap. If so, I'll ensure that the npm package gets updated as well.
Thanks @ldilley! The fix works perfectly. Please give me aheads up if possible when it gets deployed to npm. Many thanks for the prompt fix!
You are most welcome, @Conanap. I am glad that the latest PR merge resolved your issue. Version 1.0.4 has also been published to the official npm repository.
Hello! I have a web server running that displays the status of my minecraft server. Here's the relevant code:
Minecraft server is hosted on
localhost
on25565
, launched via a batch script:When the web server is initialised, and the minecraft server is not, it behaves as expected, reporting that the server is offline. Once I initialise the minecraft server, it also correctly reports ther server is now online. However, once I terminate the bashscript with
ctrl+c
, andY
to the confirmation dialogue, the status seems to be stuck as online.I've checked via the minecraft client, and the server is indeed offline.
Let me know if there's any other information I can provide, thanks!