Believe it or not, this one's not actually that difficult, but when I was looking around for how to access statistics, I had way too much trouble trying to find any tutorials on the subject, so I thought I'd post one right here.
//Be sure that the player is initialized and loaded properly, possibly through a player event.
protected StatisticsFile statsFile = Minecraft.getMinecraft().getIntegratedServer().getConfigurationManager().func_148538_i(event.entityPlayer.getCommandSenderName());
//You need to divide this amount by 100 to get the correct amount, sometimes you need to divide by different figures, be warry.
int distanceWalked = statsFile.writeStat(StatList.distanceWalkedStat / 100);
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
[1.7.2] Accessing Player Statistics Files