9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-25 01:49:30 +00:00

tag防呆

This commit is contained in:
XiaoMoMi
2025-07-25 19:20:32 +08:00
parent 779871e489
commit 032853ee7d

View File

@@ -325,7 +325,13 @@ public class ItemSettings {
}));
registerFactory("tags", (value -> {
List<String> tags = MiscUtils.getAsStringList(value);
return settings -> settings.tags(tags.stream().map(Key::of).collect(Collectors.toSet()));
return settings -> settings.tags(tags.stream().map(it -> {
if (it.charAt(0) == '#') {
return Key.of(it.substring(1));
} else {
return Key.of(it);
}
}).collect(Collectors.toSet()));
}));
registerFactory("equippable", (value -> {
Map<String, Object> args = MiscUtils.castToMap(value, false);