You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed that after server restarts the player_statistic will no longer report anything. When a player logs on, only that player will be reported under player_statistic (even if that player then logs off).
This graph shows the total PLAY_ONE_MINUTE for all players. It decreases when the server restarts, and then increases vertically as a new player logs on to the restarted server.
It seems this is a limitation with Minecraft/bukkit. I wasn't able to dig into the code to investigate the root cause. Because Player is an interface, and I can't see what player.getStatistic(statistic) does.
Suggestion: PlayerStatistics saves a file with the most recent values. If player.getStatistic(statistic) returns null, then fetch the value from the file. This isn't a great idea...
The text was updated successfully, but these errors were encountered:
Yeah, I've also noticed this before. Thanks for opening an issue for this.
Basically those stats will only show players that have been seen during the current server uptime. I think you're right that this is simply because of the way the Bukkit API works here.
Writing such a save file would be an option but I agree that it doesn't feel like the best approach - we could do that as a last resort.
Maybe we could also look into the Bukkit internals for more information on this. I was hoping maybe there's a way to work around this by emitting some kind of Bukkit event during startup so that all those offline player stats are loaded initially. Even if that works I'm not sure if that's a better idea than the save file 😄
I had a bit more of a look. I still can't see in the source code where the statistics are loaded, but I have found where they are stored: data/world/stats/<player UUID>.json. As a work-around, these files could be read on server-startup and return when player.getStatistic(statistic) returns null.
I've noticed that after server restarts the
player_statistic
will no longer report anything. When a player logs on, only that player will be reported underplayer_statistic
(even if that player then logs off).This graph shows the total
PLAY_ONE_MINUTE
for all players. It decreases when the server restarts, and then increases vertically as a new player logs on to the restarted server.It seems this is a limitation with Minecraft/bukkit. I wasn't able to dig into the code to investigate the root cause. Because
Player
is an interface, and I can't see whatplayer.getStatistic(statistic)
does.Suggestion: PlayerStatistics saves a file with the most recent values. If
player.getStatistic(statistic)
returns null, then fetch the value from the file. This isn't a great idea...The text was updated successfully, but these errors were encountered: