mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-12 13:44:28 +01:00
Removed synchronization on BlockManager methods, related to handlers
This commit is contained in:
parent
2f2254ebc2
commit
f45484c840
@ -23,17 +23,17 @@ public class BlockManager {
|
|||||||
// block id -> block placement rule
|
// block id -> block placement rule
|
||||||
private final Int2ObjectMap<BlockPlacementRule> placementRuleMap = new Int2ObjectOpenHashMap<>();
|
private final Int2ObjectMap<BlockPlacementRule> placementRuleMap = new Int2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
public synchronized void registerHandler(@NotNull String namespace, @NotNull Supplier<@NotNull BlockHandler> handlerSupplier) {
|
public void registerHandler(@NotNull String namespace, @NotNull Supplier<@NotNull BlockHandler> handlerSupplier) {
|
||||||
this.blockHandlerMap.put(namespace, handlerSupplier);
|
this.blockHandlerMap.put(namespace, handlerSupplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized @Nullable BlockHandler getHandler(@NotNull String namespace) {
|
public @Nullable BlockHandler getHandler(@NotNull String namespace) {
|
||||||
final var handler = blockHandlerMap.get(namespace);
|
final var handler = blockHandlerMap.get(namespace);
|
||||||
return handler != null ? handler.get() : null;
|
return handler != null ? handler.get() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
public synchronized @Nullable BlockHandler getHandlerOrDummy(@NotNull String namespace) {
|
public @NotNull BlockHandler getHandlerOrDummy(@NotNull String namespace) {
|
||||||
BlockHandler handler = getHandler(namespace);
|
BlockHandler handler = getHandler(namespace);
|
||||||
if (handler == null) {
|
if (handler == null) {
|
||||||
LOGGER.warn("Block {} does not have any corresponding handler, default to dummy.", namespace);
|
LOGGER.warn("Block {} does not have any corresponding handler, default to dummy.", namespace);
|
||||||
|
Loading…
Reference in New Issue
Block a user