From f45484c840dc3d25cc558b04b15a94f02a26a6b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A8=D0=B0=D0=BD=D0=B4=D1=83=D1=80=D0=B5=D0=BD=D0=BA?= =?UTF-8?q?=D0=BE=20=D0=9A=D0=BE=D0=BD=D1=81=D1=82=D0=B0=D0=BD=D1=82=D0=B8?= =?UTF-8?q?=D0=BD=20=D0=92=D0=BB=D0=B0=D0=B4=D0=B8=D0=BC=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B8=D1=87?= Date: Fri, 10 Sep 2021 16:45:04 +0300 Subject: [PATCH] Removed synchronization on BlockManager methods, related to handlers --- .../net/minestom/server/instance/block/BlockManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/minestom/server/instance/block/BlockManager.java b/src/main/java/net/minestom/server/instance/block/BlockManager.java index 446fe6dea..476f8db2f 100644 --- a/src/main/java/net/minestom/server/instance/block/BlockManager.java +++ b/src/main/java/net/minestom/server/instance/block/BlockManager.java @@ -23,17 +23,17 @@ public class BlockManager { // block id -> block placement rule private final Int2ObjectMap 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); } - public synchronized @Nullable BlockHandler getHandler(@NotNull String namespace) { + public @Nullable BlockHandler getHandler(@NotNull String namespace) { final var handler = blockHandlerMap.get(namespace); return handler != null ? handler.get() : null; } @ApiStatus.Internal - public synchronized @Nullable BlockHandler getHandlerOrDummy(@NotNull String namespace) { + public @NotNull BlockHandler getHandlerOrDummy(@NotNull String namespace) { BlockHandler handler = getHandler(namespace); if (handler == null) { LOGGER.warn("Block {} does not have any corresponding handler, default to dummy.", namespace);