Skip to content

Commit 56e9387

Browse files
committed
Use ConcurrentHashMap for kit storage in KitManager
- Replace `HashMap` with `ConcurrentHashMap` for `kitByKitIDMap` - Generalize field type to `Map<String, ItemStack[]>` for cleaner abstraction
1 parent 5b8a1d7 commit 56e9387

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/main/java/dev/noah/perplayerkit/KitManager.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,20 @@
3131

3232
import java.io.IOException;
3333
import java.util.*;
34+
import java.util.concurrent.ConcurrentHashMap;
3435

3536
public class KitManager {
3637
private static KitManager instance;
3738
private final PerPlayerKit plugin;
38-
private final HashMap<String, ItemStack[]> kitByKitIDMap;
39+
private final Map<String, ItemStack[]> kitByKitIDMap;
3940
private final HashMap<UUID, Integer> lastKitUsedByPlayer;
4041
private final List<PublicKit> publicKitList;
4142

4243
public KitManager(PerPlayerKit plugin) {
4344
this.plugin = plugin;
4445
lastKitUsedByPlayer = new HashMap<>();
4546
publicKitList = new ArrayList<>();
46-
kitByKitIDMap = new HashMap<>();
47+
kitByKitIDMap = new ConcurrentHashMap<>();
4748
instance = this;
4849
}
4950

@@ -544,4 +545,4 @@ private void applyKitLoadEffects(Player player, boolean isEnderChest) {
544545
}
545546
}
546547
}
547-
}
548+
}

0 commit comments

Comments
 (0)