Skip to content

Commit

Permalink
fix: force loading player's statistics on join
Browse files Browse the repository at this point in the history
  • Loading branch information
Misat11 committed Oct 22, 2023
1 parent 33b8883 commit 7314ccf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ public void run() {
if (Main.getConfigurator().config.getBoolean("tab.enable") && Main.getConfigurator().config.getBoolean("tab.hide-foreign-players")) {
Bukkit.getOnlinePlayers().stream().filter(Main::isPlayerInGame).forEach(p -> Main.getPlayerGameProfile(p).hidePlayer(player));
}

if (Main.isPlayerStatisticsEnabled()) {
Main.getPlayerStatisticsManager().loadStatistic(event.getPlayer().getUniqueId());
}
}

@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ private PlayerStatistic loadYamlStatistic(UUID uuid) {
playerStatistic.setName(player.getName());
}
this.playerStatistic.put(uuid, playerStatistic);
allScores.put(uuid, new AbstractMap.SimpleEntry<>(playerStatistic.getName(), playerStatistic.getScore()));
updateScore(playerStatistic);
return playerStatistic;
}

Expand Down

0 comments on commit 7314ccf

Please sign in to comment.