NightDev Community Forums

Minecraft - player stats

I’m new to Nightbot and coding in general, I’m wondering if there’s a way to have Nightbot pull player stats from my Minecraft server - I can access the JSON file with all the stats in my server files, I’m looking for a way to set up a command, for example, !deathcount, to parse the file for “minecraft:deaths” and print the result as something like “WightTaleDear has died 170 times this seed.”
Ideally I’d want to do this for other stats as well, like “Death By Beetle” → “minecraft:killed_by”:“druidcraft:beetle”-> “WTD has Died to a Beetle 12 times” or "“quark:frog” → WTD has Never Been Killed by a Frog

Hey @WightTaleDear!

Sorry, but we don’t give tutorials on how to write code here.
You’ll need your JSON file to be accessible through a URL, the $(urlfetch) and $(eval) Nightbot variables, and you’ll need to know how to navigate through a JSON file.

If you write some code, but have a hard time to make it work, then we might be able to help, if you share your code first, of course. If the JSON file is on a URL that require a private key to access it, please censor it and give us an example of the architecture of the file instead, same thing if the JSON contains sensible information.

1 Like

Thank you! I’m trying to learn and having a hard time knowing what to look for for learning resources, so this helps! I’ll take a look at the link you send and see if I can make some sense of it, hopefully I can come up with something codewise before this topic expires. Thanks again!

1 Like

If the topic expires, don’t worry, make a new one linking to this one for keep context, and maybe the mods will merge them.