Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
WalshyDev authored Feb 17, 2024
1 parent 26a398b commit c429c16
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,8 @@ public static boolean get(@Nonnull OfflinePlayer p, @Nonnull Consumer<PlayerProf

Slimefun.getRegistry().getPlayerProfiles().put(uuid, event.getProfile());

// Make sure we call this after we actually put the PlayerProfile into the map.
// Otherwise we end up with a race condition where the profile is not in the map just _yet_
// Make sure we call this after we put the PlayerProfile into the registry.
// Otherwise, we end up with a race condition where the profile is not in the map just _yet_
// but the loading flag is gone and we can end up loading it a second time (and thus can dupe items)
// Fixes https://github.com/Slimefun/Slimefun4/issues/4130
loading.remove(uuid);
Expand Down Expand Up @@ -444,8 +444,8 @@ public static boolean request(@Nonnull OfflinePlayer p) {
PlayerProfile pp = new PlayerProfile(p, data);
Slimefun.getRegistry().getPlayerProfiles().put(uuid, pp);

// Make sure we call this after we actually put the PlayerProfile into the map.
// Otherwise we end up with a race condition where the profile is not in the map just _yet_
// Make sure we call this after we put the PlayerProfile into the registry.
// Otherwise, we end up with a race condition where the profile is not in the map just _yet_
// but the loading flag is gone and we can end up loading it a second time (and thus can dupe items)
// Fixes https://github.com/Slimefun/Slimefun4/issues/4130
loading.remove(uuid);
Expand Down

0 comments on commit c429c16

Please sign in to comment.