mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2024-12-22 16:05:02 +00:00
Add default namespace when wrapping block categories by their ids
This commit is contained in:
parent
0aeca40137
commit
f2355a76d6
1 changed files with 10 additions and 1 deletions
|
@ -46,6 +46,8 @@ public class BlockTypeWrapper {
|
|||
|
||||
private static final Map<BlockType, BlockTypeWrapper> blockTypes = new HashMap<>();
|
||||
private static final Map<String, BlockTypeWrapper> 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() {
|
||||
|
|
Loading…
Reference in a new issue