mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Add default namespace when wrapping block categories by their ids
This commit is contained in:
parent
0aeca40137
commit
f2355a76d6
@ -46,6 +46,8 @@ public class BlockTypeWrapper {
|
|||||||
|
|
||||||
private static final Map<BlockType, BlockTypeWrapper> blockTypes = new HashMap<>();
|
private static final Map<BlockType, BlockTypeWrapper> blockTypes = new HashMap<>();
|
||||||
private static final Map<String, BlockTypeWrapper> blockCategories = new HashMap<>();
|
private static final Map<String, BlockTypeWrapper> blockCategories = new HashMap<>();
|
||||||
|
private static final String minecraftNamespace = "minecraft";
|
||||||
|
|
||||||
@Nullable @Getter private final BlockType blockType;
|
@Nullable @Getter private final BlockType blockType;
|
||||||
@Nullable private final String blockCategoryId;
|
@Nullable private final String blockCategoryId;
|
||||||
@Nullable private BlockCategory blockCategory;
|
@Nullable private BlockCategory blockCategory;
|
||||||
@ -78,7 +80,14 @@ public class BlockTypeWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static BlockTypeWrapper get(final String blockCategoryId) {
|
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() {
|
@Override public String toString() {
|
||||||
|
Loading…
Reference in New Issue
Block a user