Add concurrencyLevel to the MapMaker

This commit is contained in:
Kieran Wallbanks 2021-03-02 13:47:54 +00:00
parent ac57726a98
commit be5b31e207

View File

@ -26,13 +26,15 @@ import static net.minestom.server.network.packet.server.play.BossBarPacket.Actio
* boss bar management system.
*/
public class BossBarManager implements BossBar.Listener {
private static final int CONCURRENCY_LEVEL = 4;
private final Map<BossBar, Holder> bars;
/**
* Creates a new boss bar manager.
*/
public BossBarManager() {
this.bars = new MapMaker().weakKeys().makeMap();
this.bars = new MapMaker().concurrencyLevel(CONCURRENCY_LEVEL).weakKeys().makeMap();
MinecraftServer.getGlobalEventHandler().addEventCallback(PlayerDisconnectEvent.class, this::onDisconnect);
}