Skip to content

Commit

Permalink
Double-check that the cached StatEntry matches the person we're updating
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgeiss0702 committed Mar 28, 2023
1 parent 8fa4465 commit 34b7052
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/us/ajg0702/leaderboards/cache/Cache.java
Expand Up @@ -533,7 +533,7 @@ public void updateStat(String board, OfflinePlayer player) {
double timedOut = timedTypeDoubleEntry.getValue();

StatEntry statEntry = plugin.getTopManager().getCachedStatEntry(player, board, type);
if(statEntry != null) {
if(statEntry != null && player.getUniqueId().equals(statEntry.getPlayerID())) {
statEntry.changeScore(timedOut, prefix, suffix);
}

Expand All @@ -542,7 +542,7 @@ public void updateStat(String board, OfflinePlayer player) {
.get(new BoardType(board, type));
if(position != null) {
StatEntry stat = plugin.getTopManager().getCachedStat(position, board, type);
if(stat != null) {
if(stat != null && player.getUniqueId().equals(stat.getPlayerID())) {
stat.changeScore(timedOut, prefix, suffix);
}
}
Expand Down

0 comments on commit 34b7052

Please sign in to comment.