Closed erv123 closed 2 years ago
examining the code it seems that the issue is the unit being set to int, but also it looks like there are no unitless stats with decimal places so i'm not sure if changing that would require more changes
Ouch, this seems bad. I'll have a closer look soon, not sure what could cause behaviour like this. The damage stats aren't particularly different from any other stats, and such code as you describe (interpreting first decimal place as 1) doesn't exist to my knowledge. The parsing of the file to JSON is done by Python, so what I could imagine is some weird localization going on.
Thanks very much for reporting!
i'm sure this being int has something to do with it
i think the difference between damage stats and others is that only distance stats are also with decimal places
Hm, that's only used for display in the browser. Internally, if the number has a decimal separator (.
) in the JSON file, it should automatically be parsed and handled as a floating point value by Python, there's no explicit integer conversion there to my knowledge (I will have to check).
Could you please check one thing and look at the data/awards/damage_dealt.json
file that MinecraftStats should have created? If the numbers in there (do a search for your UUID) look correct, it's only a problem displaying the value in the browser. Otherwise something wrong is going on in the Python part.
i'm not the owner of the server, but i'll ask them
Edit: i checked and the value there is the same as it displays on the website
OK, then maybe there are some implicit integer casts or something like that going on in the Python part after all. Again thanks for reporting and the feedback, I'll have a look at this!
Figured it out. Everything is OK really, all parsings are fine. I just need to introduce a new unit for damage and divide all values by 10 for display in the browser. According to the Minecraft Wiki, the JSON statistics measure damage in tenths of hearts, which isn't respected by MinecraftStats. That explains why it's off by exactly a factor of 10.
The stats for damage taken, blocked and dealt are parsed incorrectly, as shown in the following screenshots
It can be seen that on the website the first decimal place of the stat is considered as a one instead of as a decimal, which makes them all 10x their actual values.