pdinklag / MinecraftStats

A Minecraft player statistics browser for the web - supports 1.13 and later!
https://discord.gg/brH5PGG8By
Other
227 stars 53 forks source link

Feedback: Add statistic for blocks placed #187

Closed braydofficial closed 2 years ago

braydofficial commented 2 years ago

Hello,

I'd wish a statistic for overall building blocks placed (for e.g. dirt etc. shouldn't be logged, but blocks placed used mainly for building i.e. stairs, wooden planks, logs, beds, glass panes, etc.)

pdinklag commented 2 years ago

Hey, your request is pretty unspecific, because you have an individual understanding of "building blocks". I may have a different one, and a third person may have another one.

In my opinion, this is a case where you should really implement the stat on your own for your specific server. All you have to do is add a new .py file to the mcstats/stats directory and implement it. You can use a similar existing stat (e.g., place_stairs) and it extend it for your needs. You can use all the existing stats as examples.

To have it displayed properly in the browser, you'll have to add an award icon (to img/award_icons) and an entry in any localization that you need.

But that's pretty much it. I recommend doing this in your own fork so you can rebase to any updates without hassle.

braydofficial commented 2 years ago

Alright, thank you very much!

braydofficial commented 2 years ago

Hm...I forked the project now and added the following file: https://github.com/braydofficial/MinecraftStats/blob/develop/mcstats/stats/place_buildblocks.py , including localization etc. The stats show up as intended and I also have a value etc. However, it only shows 89 blocks for my server, while there actually are already thousands of blocks that have been built. Not sure if I did something wrong with the syntax but I couldn't find something.

pdinklag commented 2 years ago

You got the regular expressions wrong. For example, minecraft:+_bricks will match minecraft, then one or more colons (:+) and then _bricks. That won't work. You'll want to match minecraft:.+_bricks, mind the . that matches any symbol.

This goes for all other lines involing + and *.

braydofficial commented 2 years ago

You got the regular expressions wrong. For example, minecraft:+_bricks will match minecraft, then one or more colons (:+) and then _bricks. That won't work. You'll want to match minecraft:.+_bricks, mind the . that matches any symbol.

This goes for all other lines involing + and *.

Ok, makes sense. Thank you for linking the docs!