Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import org.mvplugins.multiverse.external.jakarta.inject.Inject;
import org.mvplugins.multiverse.inventories.share.Sharable;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

/**
* Keeps track of players who are currently having their sharable handling processed.
Expand All @@ -26,7 +26,7 @@ public final class PlayerShareHandlingState {

@Inject
PlayerShareHandlingState() {
this.playerAffectedProfiles = new HashMap<>();
this.playerAffectedProfiles = new ConcurrentHashMap<>();
}

void setPlayerAffectedProfiles(Player player, AffectedProfiles status) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ private void updatePlayer() {
for (PersistingProfile readProfile : affectedProfiles.getReadProfiles()) {
ShareHandlingUpdater.updatePlayer(inventories, player, readProfile);
}
playerShareHandlingState.removePlayerAffectedProfiles(player);
}

private CompletableFuture<Void> updateProfiles(ProfileDataSnapshot snapshot) {
Expand All @@ -104,7 +103,8 @@ private CompletableFuture<Void> updateProfiles(ProfileDataSnapshot snapshot) {
return CompletableFuture.allOf(affectedProfiles.getWriteProfiles()
.stream()
.map(writeProfile -> updatePersistingProfile(writeProfile, snapshot))
.toArray(CompletableFuture[]::new));
.toArray(CompletableFuture[]::new))
.thenRun(() -> playerShareHandlingState.removePlayerAffectedProfiles(player));
}

private CompletableFuture<Void> updatePersistingProfile(PersistingProfile persistingProfile, ProfileDataSnapshot snapshot) {
Expand Down
Loading