From f2355a76d68014306315dc31eb0fe731b091cec8 Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Sun, 6 Sep 2020 23:36:36 +0200 Subject: [PATCH] Add default namespace when wrapping block categories by their ids --- .../core/plot/flag/types/BlockTypeWrapper.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java index 9af840d4c..d29140672 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java @@ -46,6 +46,8 @@ public class BlockTypeWrapper { private static final Map blockTypes = new HashMap<>(); private static final Map blockCategories = new HashMap<>(); + private static final String minecraftNamespace = "minecraft"; + @Nullable @Getter private final BlockType blockType; @Nullable private final String blockCategoryId; @Nullable private BlockCategory blockCategory; @@ -78,7 +80,14 @@ public class BlockTypeWrapper { } public static BlockTypeWrapper get(final String blockCategoryId) { - return blockCategories.computeIfAbsent(blockCategoryId, BlockTypeWrapper::new); + // use minecraft as default namespace + String id; + if (blockCategoryId.indexOf(':') == -1) { + id = minecraftNamespace + ":" + blockCategoryId; + } else { + id = blockCategoryId; + } + return blockCategories.computeIfAbsent(id, BlockTypeWrapper::new); } @Override public String toString() {