From 597f292c163ffd492787282ce36066f9c94a2194 Mon Sep 17 00:00:00 2001 From: themode Date: Sat, 14 Nov 2020 01:47:25 +0100 Subject: [PATCH] Synchronize BlockManager registration methods --- .../java/net/minestom/server/instance/block/BlockManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 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 e002a639a..379063e4a 100644 --- a/src/main/java/net/minestom/server/instance/block/BlockManager.java +++ b/src/main/java/net/minestom/server/instance/block/BlockManager.java @@ -25,7 +25,7 @@ public class BlockManager { * @throws IllegalArgumentException if customBlock block id is not greater than 0 * @throws IllegalStateException if the id of customBlock is already registered */ - public void registerCustomBlock(@NotNull CustomBlock customBlock) { + public synchronized void registerCustomBlock(@NotNull CustomBlock customBlock) { final short id = customBlock.getCustomBlockId(); Check.argCondition(id <= 0, "Custom block ID must be greater than 0, got: " + id); Check.stateCondition(customBlocksInternalId[id] != null, "a CustomBlock with the id " + id + " already exists"); @@ -41,7 +41,7 @@ public class BlockManager { * @param blockPlacementRule the block placement rule to register * @throws IllegalArgumentException if blockPlacementRule block id is negative */ - public void registerBlockPlacementRule(@NotNull BlockPlacementRule blockPlacementRule) { + public synchronized void registerBlockPlacementRule(@NotNull BlockPlacementRule blockPlacementRule) { final short id = blockPlacementRule.getBlockId(); Check.argCondition(id < 0, "Block ID must be >= 0, got: " + id);