-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
total amount of all mined blocks #136
Comments
I am working on this, but this will only be possible once PlayerStats can work with a database. Minecraft doesn't store statistics for total mined blocks, so I would have to look up all values for every single block (and in 1.19.4 there are 998 different blocks) and count them up manually. For one player, this might be doable, but for a top 10 or server total, this means I would have to check up to 998 values for every single player - and that would very quickly become an intense operation for the server to do. Once I have database support implemented, it will be a lot less intense to look up this many values, and I am planning to add a feature for all blocks mined then. |
Hello! Spigot api has total amount of mined blocks statistic implementation: https://helpch.at/docs/1.13.1/org/bukkit/Statistic.html#MINE_BLOCK Seems like you don't have to sum all ingame mined blocks if I am correct Thank you for an awesome plugin! |
Thanks for the compliment! :) And the Spigot API is actually exactly what I am using - but you can't get a total value for mine_block that way. You can only get a value for mine_block if you also supply a specific block. Here you can see there are 3 methods to get a statistic value (all called getStatistic), one for entity-type statistics, one for material-types, and a general one: The general one throws an error if you try to use it for mine_block, so you have to use the one for material-types and supply a valid material (a block). The screenshot you shared is from the statistic expansion for PlaceholderAPI, and I've looked into how they are doing it before. You can see their code here if you are curious: https://github.com/PlaceholderAPI/Statistics-Expansion/blob/master/src/main/java/com/extendedclip/papi/expansion/mcstatistics/StatisticsExpansion.java They are also using the Spigot API, and they are calculating the total for mine_block by looping through every single block and getting the corresponding statistic value for the given player. And like I said, that works fine for a single player, but very quickly becomes a performance issue if you have to do it for every player that has ever played on the server (as is the case for a top 10 or server total). Once PlayerStats can make use of a database, I can store all the values in there and get all mined blocks at once - so that's when I can safely implement a feature for total mined blocks. |
I´m hyped for this. By the way, a very cool plugin - since I installed it there is much more competition - especially who has eaten the most pieces of cake.
|
mine_block all
The text was updated successfully, but these errors were encountered: