diff --git a/bukkit/loader/src/main/resources/translations/en.yml b/bukkit/loader/src/main/resources/translations/en.yml index 884684e4c..aaa30b4ca 100644 --- a/bukkit/loader/src/main/resources/translations/en.yml +++ b/bukkit/loader/src/main/resources/translations/en.yml @@ -70,7 +70,7 @@ warning.config.type.float: "Issue found in file - Failed to load warning.config.type.double: "Issue found in file - Failed to load '': Cannot cast '' to double type for option ''." warning.config.type.quaternionf: "Issue found in file - Failed to load '': Cannot cast '' to Quaternionf type for option ''." warning.config.type.vector3f: "Issue found in file - Failed to load '': Cannot cast '' to Vector3f type for option ''." -warning.config.structure.not_section: "Issue found in file - '' is expected to be a config section while it's actually a(n) ''." +warning.config.structure.not_section: "Issue found in file - The config '' is expected to be a config section while it's actually a(n) ''." warning.config.image.duplicate: "Issue found in file - Duplicated image ''." warning.config.image.missing_height: "Issue found in file - The image '' is missing the required 'height' argument." warning.config.image.height_ascent_conflict: "Issue found in file - The image '' violates the bitmap image rule: 'height' argument '' should be no lower than 'ascent' argument ''." @@ -100,7 +100,7 @@ warning.config.recipe.smithing_transform.post_processor.keep_component.missing_c warning.config.recipe.smithing_transform.post_processor.keep_component.missing_tags: "Issue found in file - The smithing transform recipe '' is missing the required argument 'tags' for post-processors 'keep_tags'." warning.config.i18n.unknown_locale: "Issue found in file - Unknown locale ''." warning.config.template.duplicate: "Issue found in file - Duplicated template ''." -warning.config.template.invalid_range: "Issue found in file - The template '' has a 'from' argument '' larger than 'to' argument ''." +warning.config.template.argument.self_increase_int.invalid_range: "Issue found in file - The template '' is using a 'from' '' larger than 'to' '' in 'self_increase_int' argument." warning.config.vanilla_loot.missing_type: "Issue found in file - 'type' not set for vanilla loot ''." warning.config.vanilla_loot.block.invalid_target: "Issue found in file - Invalid block target '' in vanilla loot ''." warning.config.sound.duplicate: "Issue found in file - Duplicated sound ''." @@ -119,7 +119,7 @@ warning.config.item.settings.unknown: "Issue found in file - The warning.config.item.missing_material: "Issue found in file - The item '' is missing the required 'material' argument." warning.config.item.invalid_material: "Issue found in file - The item '' is using an invalid material type ''." warning.config.item.bad_custom_model_data: "Issue found in file - The item '' is using a custom model data '' that is too large. It's recommended to use a value lower than 16,777,216." -warning.config.item.custom_model_conflict: "Issue found in file - The item '' is using a custom model data '' that has been occupied by item ''." +warning.config.item.custom_model_data_conflict: "Issue found in file - The item '' is using a custom model data '' that has been occupied by item ''." warning.config.item.missing_model_id: "Issue found in file - The item '' is missing the required 'custom-model-data' or 'item-model' argument." warning.config.item.behavior.missing_type: "Issue found in file - The item '' is missing the required 'type' argument for its item behavior." warning.config.item.behavior.invalid_type: "Issue found in file - The item '' is using an invalid item behavior type ''." @@ -139,8 +139,8 @@ warning.config.item.model.condition.missing_property: "Issue found in fi warning.config.item.model.condition.invalid_property: "Issue found in file - The item '' is using an invalid property '' for model 'minecraft:condition'." warning.config.item.model.condition.missing_on_true: "Issue found in file - The item '' is missing the required 'on-true' argument for model 'minecraft:condition'." warning.config.item.model.condition.missing_on_false: "Issue found in file - The item '' is missing the required 'on-false' argument for model 'minecraft:condition'." -warning.config.item.model.condition.keybind.missing: "Issue found in file - The item '' is missing the required 'keybind' argument for 'minecraft:keybind_down' property." -warning.config.item.model.condition.missing_component: "Issue found in file - The item '' is missing the required 'component' argument for 'minecraft:has_component' property." +warning.config.item.model.condition.keybind.missing: "Issue found in file - The item '' is missing the required 'keybind' argument for property 'minecraft:keybind_down'." +warning.config.item.model.condition.has_component.missing_component: "Issue found in file - The item '' is missing the required 'component' argument for property 'minecraft:has_component'." warning.config.item.model.composite.missing_models: "Issue found in file - The item '' is missing the required 'models' argument for 'minecraft:composite' model." warning.config.item.model.range_dispatch.missing_property: "Issue found in file - The item '' is missing the required 'property' argument for model 'minecraft:range_dispatch'." warning.config.item.model.range_dispatch.invalid_property: "Issue found in file - The item '' is using an invalid property '' for model 'minecraft:range_dispatch'." @@ -162,7 +162,7 @@ warning.config.block.missing_state: "Issue found in file - The b warning.config.block.state.property.missing_type: "Issue found in file - The block '' is missing the required 'type' argument for property ''." warning.config.block.state.property.invalid_type: "Issue found in file - The block '' is using the invalid type argument '' for property ''." warning.config.block.state.property.integer.invalid_range: "Issue found in file - The block '' is using the invalid 'range' argument '' for integer property ''. Correct syntax: 1~2." -warning.config.block.state.missing_real_id: "Issue found in file - The block '' is missing the required 'id' argument for 'state'." +warning.config.block.state.missing_real_id: "Issue found in file - The block '' is missing the required 'id' argument for 'state'. 'id' is the serverside block id which is unique for each type of block state. If you create a serverside side block with 'note_block' and id 30, then the real block id would be 'craftengine:note_block_30'." warning.config.block.state.missing_state: "Issue found in file - The block '' is missing the required 'state' argument for 'state'." warning.config.block.state.missing_properties: "Issue found in file - The block '' is missing the required 'properties' section for 'states'." warning.config.block.state.missing_appearances: "Issue found in file - The block '' is missing the required 'appearances' section for 'states'." @@ -174,8 +174,6 @@ warning.config.block.state.unavailable_vanilla: "Issue found in file Issue found in file - The block '' is using a vanilla block state '' that exceeds the available slot range '0~'." warning.config.block.state.conflict: "Issue found in file - The block '' is using a vanilla block state '' that has been occupied by ''." warning.config.block.state.bind_failed: "Issue found in file - The block '' failed to bind real block state for '' as the state has been occupied by ''." -warning.config.block.state.invalid_structure: "Issue found in file - The block '' has an invalid property structure ''." -warning.config.block.state.creation_failed: "Issue found in file - Failed to create property '' for block '': ." warning.config.block.state.missing_model: "Issue found in file - The block '' is missing the required 'model' or 'models' argument." warning.config.block.state.invalid_real_id: "Issue found in file - The block '' is using a real block state '' that exceeds the available slot range '0~'. Consider adding more real states in 'additional-real-blocks.yml' if the slots are used up." warning.config.block.state.model.missing_path: "Issue found in file - The block '' is missing the required 'path' option for 'model'." @@ -218,11 +216,13 @@ warning.config.loot_table.condition.missing_type: "Issue found in file < warning.config.loot_table.condition.invalid_type: "Issue found in file - '' has a misconfigured loot table, one of the conditions is using an invalid condition type ''." warning.config.loot_table.condition.table_bonus.missing_enchantment: "Issue found in file - '' has a misconfigured loot table, 'table_bonus' condition is missing the required 'enchantment' argument." warning.config.loot_table.condition.table_bonus.missing_chances: "Issue found in file - '' has a misconfigured loot table, 'table_bonus' condition is missing the required 'chances' argument." +warning.config.loot_table.number.missing_type: "Issue found in file - '' has a misconfigured loot table, one of the numbers is missing the required 'type' argument." +warning.config.loot_table.number.invalid_type: "Issue found in file - '' has a misconfigured loot table, one of the numbers is using an invalid number type ''." warning.config.host.missing_type: "Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'type' argument for host." warning.config.host.invalid_type: "Issue found in config.yml at 'resource-pack.delivery.hosting' - Host type '' is invalid. Please read https://mo-mi.gitbook.io/xiaomomi-plugins/craftengine/plugin-wiki/craftengine/resource-pack/host." warning.config.host.external.missing_url: "Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'url' argument for external host." warning.config.host.alist.missing_api_url: "Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'api-url' argument for alist host." -warning.config.host.alist.missing_credentials: "Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'username' argument or environment variable 'CE_ALIST_USERNAME' for alist host." +warning.config.host.alist.missing_username: "Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'username' argument or environment variable 'CE_ALIST_USERNAME' for alist host." warning.config.host.alist.missing_password: "Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'password' argument or environment variable 'CE_ALIST_PASSWORD' for alist host." warning.config.host.alist.missing_upload_path: "Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'upload-path' argument for alist host." warning.config.host.dropbox.missing_app_key: "Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'app-key' argument or environment variable 'CE_DROPBOX_APP_KEY' for dropbox host." diff --git a/bukkit/loader/src/main/resources/translations/zh_cn.yml b/bukkit/loader/src/main/resources/translations/zh_cn.yml index e4e3185bc..203b8e906 100644 --- a/bukkit/loader/src/main/resources/translations/zh_cn.yml +++ b/bukkit/loader/src/main/resources/translations/zh_cn.yml @@ -62,58 +62,4 @@ command.resource.list: "启用的资源(): < command.upload.failure.not_supported: "当前托管模式 '' 不支持上传资源包." command.upload.on_progress: "已开始上传进程. 检查控制台以获取详细信息." command.send_resource_pack.success.single: "发送资源包给 " -command.send_resource_pack.success.multiple: "发送资源包给 个玩家" -warning.config.image.duplicated: "在文件 中发现问题 - 图片 '' 重复定义" -warning.config.image.lack_height: "在文件 中发现问题 - 图片 '' 缺少必要的 'height' 高度参数" -warning.config.image.height_smaller_than_ascent: "在文件 中发现问题 - 图片 '' 违反位图规则:'height' 高度值[]不应小于 'ascent' 基准线高度[]" -warning.config.image.lack_file: "在文件 中发现问题 - 图片 '' 缺少必要的 'file' 文件参数" -warning.config.image.invalid_resource_location: "在文件 中发现问题 - 图片 '' 的 'file' 参数 [] 包含非法字符,请参考资源路径规范:https://zh.minecraft.wiki/w/%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4ID#%E5%90%88%E6%B3%95%E5%AD%97%E7%AC%A6" -warning.config.image.invalid_font_name: "在文件 中发现问题 - 图片 '' 的 'font' 字体参数 [] 包含非法字符,请参考资源路径规范:https://zh.minecraft.wiki/w/%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4ID#%E5%90%88%E6%B3%95%E5%AD%97%E7%AC%A6" -warning.config.image.lack_char: "在文件 中发现问题 - 图片 '' 缺少必要的 'char' 字符参数" -warning.config.image.codepoint_in_use: "在文件 中发现问题 - 图片 '' 使用的字体 字符 [()] 已被其他图片 '' 占用" -warning.config.image.invalid_codepoint_grid: "在文件 中发现问题 - 图片 '' 的 'chars' 码位网格配置无效" -warning.config.image.file_not_exist: "在文件 中发现问题 - 图片 '' 对应的PNG文件 不存在" -warning.config.recipe.duplicated: "在文件 中发现问题 - 配方 '' 重复定义" -warning.config.i18n.unknown_locale: "在文件 中发现问题 - 未知的语言 ''" -warning.config.template.duplicated: "在文件 中发现问题 - 模板 '' 重复定义" -warning.config.vanilla_loot.type_not_exist: "在文件 中发现问题 - 原版战利品 '' 未设置 'type' 类型参数" -warning.config.vanilla_loot.block.invalid_target: "在文件 中发现问题 - 原版战利品 '' 中的方块目标 [] 无效" -warning.config.sound.duplicated: "在文件 中发现问题 - 音效 '' 重复定义" -warning.config.jukebox_song.duplicated: "在文件 中发现问题 - 唱片机歌曲 '' 重复定义" -warning.config.furniture.duplicated: "在文件 中发现问题 - 家具 '' 重复定义" -warning.config.furniture.lack_placement: "在文件 中发现问题 - 家具 '' 缺少必要的 'placement' 放置参数" -warning.config.furniture.element.lack_item: "在文件 中发现问题 - 家具 '' 的某个元素缺少必要的 'item' 物品参数" -warning.config.item.duplicated: "在文件 中发现问题 - 物品 '' 重复定义" -warning.config.item.lack_material: "在文件 中发现问题 - 物品 '' 缺少必要的 'material' 材料参数" -warning.config.item.invalid_material: "在文件 中发现问题 - 物品 '' 使用了无效的材料类型 ''" -warning.config.item.bad_custom_model_data_value: "在文件 中发现问题 - 物品 '' 的自定义模型数据值 [] 过大,建议使用低于16,777,216的值" -warning.config.item.custom_model_data_conflict: "在文件 中发现问题 - 物品 '' 的自定义模型数据 [] 与物品 '' 发生冲突" -warning.config.item.lack_model_id: "在文件 中发现问题 - 物品 '' 缺少必要的 'custom-model-data' 或 'item-model' 模型标识参数" -warning.config.block.duplicated: "在文件 中发现问题 - 方块 '' 重复定义" -warning.config.block.lack_state: "在文件 中发现问题 - 方块 '' 缺少必要的 'state' 状态参数" -warning.config.block.state.lack_real_id: "在文件 中发现问题 - 方块 '' 的 'state' 配置缺少必要的 'id' 标识参数" -warning.config.block.state.lack_state: "在文件 中发现问题 - 方块 '' 的 'state' 配置缺少必要的 'state' 状态参数" -warning.config.block.state.lack_properties: "在文件 中发现问题 - 方块 '' 的 'states' 配置缺少必要的 'properties' 属性配置" -warning.config.block.state.lack_appearances: "在文件 中发现问题 - 方块 '' 的 'states' 配置缺少必要的 'appearances' 外观配置" -warning.config.block.state.lack_variants: "在文件 中发现问题 - 方块 '' 的 'states' 配置缺少必要的 'variants' 变体配置" -warning.config.block.state.variant.lack_appearance: "在文件 中发现问题 - 方块 '' 的 '' 变体配置缺少必要的 'appearance' 外观参数" -warning.config.block.state.variant.invalid_appearance: "在文件 中发现问题 - 方块 '' 的 '' 变体引用了不存在的外观配置 ''" -warning.config.block.state.invalid_state: "在文件 中发现问题 - 方块 '' 使用了无效的原版方块状态 ''" -warning.config.block.state.unavailable_state: "在文件 中发现问题 - 方块 '' 使用了不可用的原版方块状态 ''" -warning.config.block.state.invalid_vanilla_state_id: "在文件 中发现问题 - 方块 '' 使用的原版方块状态 '' 超出可用槽位范围 '0~'" -warning.config.block.state.conflict: "在文件 中发现问题 - 方块 '' 使用的原版方块状态 '' 已被 '' 占用" -warning.config.block.state.bind_real_state: "在文件 中发现问题 - 方块 '' 未能绑定真实方块状态 '',该状态已被 '' 占用" -warning.config.block.state.invalid_property_structure: "在文件 中发现问题 - 方块 '' 的属性结构 '' 配置无效" -warning.config.block.state.invalid_property: "在文件 中发现问题 - 无法为方块 '' 创建属性 '':" -warning.config.block.state.no_model_set: "在文件 中发现问题 - 方块 '' 缺少必要的 'model' 或 'models' 模型参数" -warning.config.block.state.invalid_real_state_id: "在文件 中发现问题 - 方块 '' 使用的真实方块状态 '' 超出可用槽位范围 '0~'。若槽位已用尽,请考虑在 additional-real-blocks.yml 中添加更多真实状态" -warning.config.block.state.model.lack_path: "在文件 中发现问题 - 方块 '' 的 'model' 配置缺少必要的 'path' 路径参数" -warning.config.block.state.model.invalid_resource_location: "在文件 中发现问题 - 方块 '' 的 'path' 路径参数 [] 包含非法字符,请参考资源路径规范:https://zh.minecraft.wiki/w/%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4ID#%E5%90%88%E6%B3%95%E5%AD%97%E7%AC%A6" -warning.config.model.generation.conflict: "在文件 中发现问题 - 无法为 '' 生成模型,多个配置尝试用相同路径 '' 生成不同的JSON模型" -warning.config.model.generation.texture.invalid_resource_location: "在文件 中发现问题 - 配置项 '' 的 '' 纹理参数 [] 包含非法字符,请参考资源路径规范:https://zh.minecraft.wiki/w/%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4ID#%E5%90%88%E6%B3%95%E5%AD%97%E7%AC%A6" -warning.config.model.generation.parent.invalid_resource_location: "在文件 中发现问题 - 配置项 '' 的父模型参数 [] 包含非法字符,请参考资源路径规范:https://zh.minecraft.wiki/w/%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4ID#%E5%90%88%E6%B3%95%E5%AD%97%E7%AC%A6" -warning.config.emoji.lack_keywords: "在文件 中发现问题 - 表情 '' 缺少必要的 'keywords' 配置" -warning.config.emoji.duplicated: "在文件 中发现问题 - 表情 '' 重复定义" -warning.config.emoji.invalid_image: "在文件 中发现问题 - 表情 '' 使用了无效的 'image' 图片参数 ''." -warning.config.advancement.duplicated: "在文件 中发现问题 - 进度 '' 重复定义" -# 先不要急着汉化,目前语言改动较大 \ No newline at end of file +command.send_resource_pack.success.multiple: "发送资源包给 个玩家" \ No newline at end of file diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/advancement/BukkitAdvancementManager.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/advancement/BukkitAdvancementManager.java index 13633211e..74e2a5916 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/advancement/BukkitAdvancementManager.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/advancement/BukkitAdvancementManager.java @@ -51,7 +51,7 @@ public class BukkitAdvancementManager extends AbstractAdvancementManager { @Override public void parseSection(Pack pack, Path path, Key id, Map section) { if (advancements.containsKey(id)) { - throw new LocalizedResourceConfigException("warning.config.advancement.duplicated", path, id); + throw new LocalizedResourceConfigException("warning.config.advancement.duplicate", path, id); } JsonElement jsonTree = GsonHelper.get().toJsonTree(section); FastNMS.INSTANCE.registerAdvancement(id.decompose(), jsonTree); diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/BukkitBlockManager.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/BukkitBlockManager.java index f7e0369a3..5a2a01441 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/BukkitBlockManager.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/BukkitBlockManager.java @@ -332,7 +332,7 @@ public class BukkitBlockManager extends AbstractBlockManager { public void parseSection(Pack pack, Path path, Key id, Map section) { // check duplicated config if (byId.containsKey(id)) { - throw new LocalizedResourceConfigException("warning.config.block.duplicated", path, id); + throw new LocalizedResourceConfigException("warning.config.block.duplicate", path, id); } // read block settings BlockSettings settings = BlockSettings.fromMap(MiscUtils.castToMap(section.getOrDefault("settings", Map.of()), false)); @@ -349,7 +349,7 @@ public class BukkitBlockManager extends AbstractBlockManager { properties = Map.of(); int internalId = ResourceConfigUtils.getAsInt(stateSection.getOrDefault("id", -1), "id"); if (internalId < 0) { - throw new LocalizedResourceConfigException("warning.config.block.state.lack_real_id", path, id); + throw new LocalizedResourceConfigException("warning.config.block.state.missing_real_id", path, id); } Pair pair = parseAppearanceSection(pack, path, id, stateSection); @@ -360,7 +360,7 @@ public class BukkitBlockManager extends AbstractBlockManager { Key internalBlockId = Key.of(CraftEngine.NAMESPACE, internalBlock); int internalBlockRegistryId = Optional.ofNullable(internalId2StateId.get(internalBlockId)).orElse(-1); if (internalBlockRegistryId == -1) { - throw new LocalizedResourceConfigException("warning.config.block.state.invalid_real_state_id", path, id, + throw new LocalizedResourceConfigException("warning.config.block.state.invalid_real_id", path, id, internalBlock, String.valueOf(registeredRealBlockSlots.get(pair.left()) - 1)); } @@ -369,18 +369,18 @@ public class BukkitBlockManager extends AbstractBlockManager { // states Map statesSection = MiscUtils.castToMap(section.get("states"), true); if (statesSection == null) { - throw new LocalizedResourceConfigException("warning.config.block.lack_state", path, id); + throw new LocalizedResourceConfigException("warning.config.block.missing_state", path, id); } // properties Map propertySection = MiscUtils.castToMap(statesSection.get("properties"), true); if (propertySection == null) { - throw new LocalizedResourceConfigException("warning.config.block.state.lack_properties", path, id); + throw new LocalizedResourceConfigException("warning.config.block.state.missing_properties", path, id); } - properties = parseProperties(path, id, propertySection); + properties = parseProperties(propertySection); // appearance Map appearancesSection = MiscUtils.castToMap(statesSection.get("appearances"), true); if (appearancesSection == null) { - throw new LocalizedResourceConfigException("warning.config.block.state.lack_appearances", path, id); + throw new LocalizedResourceConfigException("warning.config.block.state.missing_appearances", path, id); } appearances = new HashMap<>(); Map tempTypeMap = new HashMap<>(); @@ -395,7 +395,7 @@ public class BukkitBlockManager extends AbstractBlockManager { // variants Map variantsSection = MiscUtils.castToMap(statesSection.get("variants"), true); if (variantsSection == null) { - throw new LocalizedResourceConfigException("warning.config.block.state.lack_variants", path, id); + throw new LocalizedResourceConfigException("warning.config.block.state.missing_variants", path, id); } variants = new HashMap<>(); for (Map.Entry variantEntry : variantsSection.entrySet()) { @@ -404,7 +404,7 @@ public class BukkitBlockManager extends AbstractBlockManager { String variantName = variantEntry.getKey(); String appearance = (String) variantSection.get("appearance"); if (appearance == null) { - throw new LocalizedResourceConfigException("warning.config.block.state.variant.lack_appearance", path, id, variantName); + throw new LocalizedResourceConfigException("warning.config.block.state.variant.missing_appearance", path, id, variantName); } if (!appearances.containsKey(appearance)) { throw new LocalizedResourceConfigException("warning.config.block.state.variant.invalid_appearance", path, id, variantName, appearance); @@ -414,7 +414,7 @@ public class BukkitBlockManager extends AbstractBlockManager { Key internalBlockId = Key.of(CraftEngine.NAMESPACE, baseBlock.value() + "_" + internalId); int internalBlockRegistryId = Optional.ofNullable(internalId2StateId.get(internalBlockId)).orElse(-1); if (internalBlockRegistryId == -1) { - throw new LocalizedResourceConfigException("warning.config.block.state.invalid_real_state_id", path, id, + throw new LocalizedResourceConfigException("warning.config.block.state.invalid_real_id", path, id, internalBlockId.toString(), String.valueOf(registeredRealBlockSlots.getOrDefault(baseBlock, 1) - 1)); } @@ -439,7 +439,7 @@ public class BukkitBlockManager extends AbstractBlockManager { for (ImmutableBlockState state : block.variantProvider().states()) { ImmutableBlockState previous = stateId2ImmutableBlockStates[state.customBlockState().registryId() - BlockStateUtils.vanillaStateSize()]; if (previous != null && !previous.isEmpty()) { - TranslationManager.instance().log("warning.config.block.state.bind_real_state", path.toString(), id.toString(), state.toString(), previous.toString()); + TranslationManager.instance().log("warning.config.block.state.bind_failed", path.toString(), id.toString(), state.toString(), previous.toString()); continue; } stateId2ImmutableBlockStates[state.customBlockState().registryId() - BlockStateUtils.vanillaStateSize()] = state; @@ -458,19 +458,11 @@ public class BukkitBlockManager extends AbstractBlockManager { } } - private Map> parseProperties(Path path, Key id, Map propertiesSection) { + private Map> parseProperties(Map propertiesSection) { Map> properties = new HashMap<>(); for (Map.Entry entry : propertiesSection.entrySet()) { - if (entry.getValue() instanceof Map params) { - try { - Property property = Properties.fromMap(entry.getKey(), MiscUtils.castToMap(params, false)); - properties.put(entry.getKey(), property); - } catch (Exception e) { - TranslationManager.instance().log("warning.config.block.state.invalid_property", path.toString(), id.toString(), entry.getKey(), e.getMessage()); - } - } else { - TranslationManager.instance().log("warning.config.block.state.invalid_property_structure", path.toString(), id.toString(), entry.getKey()); - } + Property property = Properties.fromMap(entry.getKey(), MiscUtils.castToMap(entry.getValue(), false)); + properties.put(entry.getKey(), property); } return properties; } @@ -478,15 +470,14 @@ public class BukkitBlockManager extends AbstractBlockManager { @Nullable private Pair parseAppearanceSection(Pack pack, Path path, Key id, Map section) { // require state non null - String vanillaStateString = (String) section.get("state"); + Object vanillaStateString = section.get("state"); if (vanillaStateString == null) { - TranslationManager.instance().log("warning.config.block.state.lack_state", path.toString(), id.toString()); - return null; + throw new LocalizedResourceConfigException("warning.config.block.state.missing_state", path, id); } // get its registry id int vanillaStateRegistryId; - VanillaStateParseResult parseResult = parseVanillaStateRegistryId(vanillaStateString); + VanillaStateParseResult parseResult = parseVanillaStateRegistryId(vanillaStateString.toString()); if (parseResult.success()) { vanillaStateRegistryId = parseResult.result; } else { @@ -506,10 +497,12 @@ public class BukkitBlockManager extends AbstractBlockManager { } // require models not to be null - Object models = section.getOrDefault("models", section.get("model")); + Object models = section.get("models"); if (models == null) { - TranslationManager.instance().log("warning.config.block.state.no_model_set", path.toString(), id.toString()); - return null; + models = section.get("model"); + } + if (models == null) { + throw new LocalizedResourceConfigException("warning.config.block.state.missing_model", path, id); } List variants = new ArrayList<>(); @@ -547,12 +540,10 @@ public class BukkitBlockManager extends AbstractBlockManager { JsonObject json = new JsonObject(); String modelPath = (String) singleModelMap.get("path"); if (modelPath == null) { - TranslationManager.instance().log("warning.config.block.state.model.lack_path", path.toString(), id.toString()); - return; + throw new LocalizedResourceConfigException("warning.config.block.state.model.missing_path"); } if (!ResourceLocation.isValid(modelPath)) { - TranslationManager.instance().log("warning.config.block.state.model.invalid_resource_location", path.toString(), id.toString(), modelPath); - return; + throw new LocalizedResourceConfigException("warning.config.block.state.model.invalid_path", modelPath); } json.addProperty("model", modelPath); if (singleModelMap.containsKey("x")) json.addProperty("x", ResourceConfigUtils.getAsInt(singleModelMap.get("x"), "x")); @@ -561,7 +552,7 @@ public class BukkitBlockManager extends AbstractBlockManager { if (singleModelMap.containsKey("weight")) json.addProperty("weight", ResourceConfigUtils.getAsInt(singleModelMap.get("weight"), "weight")); Map generationMap = MiscUtils.castToMap(singleModelMap.get("generation"), true); if (generationMap != null) { - prepareModelGeneration(path, id, new ModelGeneration(Key.of(modelPath), generationMap)); + prepareModelGeneration(new ModelGeneration(Key.of(modelPath), generationMap)); } variants.add(json); } @@ -569,33 +560,33 @@ public class BukkitBlockManager extends AbstractBlockManager { private VanillaStateParseResult parseVanillaStateRegistryId(String blockState) { String[] split = blockState.split(":", 3); if (split.length >= 4) { - return VanillaStateParseResult.failure("warning.config.block.state.invalid_state", new String[]{blockState}); + return VanillaStateParseResult.failure("warning.config.block.state.invalid_vanilla", new String[]{blockState}); } int registryId; String stateOrId = split[split.length - 1]; boolean isId = !stateOrId.contains("[") && !stateOrId.contains("]"); if (isId) { - if (split.length == 1) return VanillaStateParseResult.failure("warning.config.block.state.invalid_state", new String[]{blockState}); + if (split.length == 1) return VanillaStateParseResult.failure("warning.config.block.state.invalid_vanilla", new String[]{blockState}); Key block = split.length == 2 ? Key.of(split[0]) : Key.of(split[0], split[1]); try { int id = split.length == 2 ? Integer.parseInt(split[1]) : Integer.parseInt(split[2]); - if (id < 0) return VanillaStateParseResult.failure("warning.config.block.state.invalid_state", new String[]{blockState}); + if (id < 0) return VanillaStateParseResult.failure("warning.config.block.state.invalid_vanilla", new String[]{blockState}); List arranger = this.blockAppearanceArranger.get(block); - if (arranger == null) return VanillaStateParseResult.failure("warning.config.block.state.unavailable_state", new String[]{blockState}); - if (id >= arranger.size()) return VanillaStateParseResult.failure("warning.config.block.state.invalid_vanilla_state_id", new String[]{blockState, String.valueOf(arranger.size() - 1)}); + if (arranger == null) return VanillaStateParseResult.failure("warning.config.block.state.unavailable_vanilla", new String[]{blockState}); + if (id >= arranger.size()) return VanillaStateParseResult.failure("warning.config.block.state.invalid_vanilla_id", new String[]{blockState, String.valueOf(arranger.size() - 1)}); registryId = arranger.get(id); } catch (NumberFormatException e) { - return VanillaStateParseResult.failure("warning.config.block.state.invalid_state", new String[]{blockState}); + return VanillaStateParseResult.failure("warning.config.block.state.invalid_vanilla", new String[]{blockState}); } } else { try { BlockData blockData = Bukkit.createBlockData(blockState); registryId = BlockStateUtils.blockDataToId(blockData); if (!this.blockAppearanceMapper.containsKey(registryId)) { - return VanillaStateParseResult.failure("warning.config.block.state.unavailable_state", new String[]{blockState}); + return VanillaStateParseResult.failure("warning.config.block.state.unavailable_vanilla", new String[]{blockState}); } } catch (IllegalArgumentException e) { - return VanillaStateParseResult.failure("warning.config.block.state.invalid_state", new String[]{blockState}); + return VanillaStateParseResult.failure("warning.config.block.state.invalid_vanilla", new String[]{blockState}); } } return VanillaStateParseResult.success(registryId); diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/ConcretePowderBlockBehavior.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/ConcretePowderBlockBehavior.java index 22e651c7d..868d8c87f 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/ConcretePowderBlockBehavior.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/ConcretePowderBlockBehavior.java @@ -157,7 +157,7 @@ public class ConcretePowderBlockBehavior extends FallingBlockBehavior { int hurtMax = ResourceConfigUtils.getAsInt(arguments.getOrDefault("max-hurt", -1), "max-hurt"); String solidBlock = (String) arguments.get("solid-block"); if (solidBlock == null) { - throw new LocalizedResourceConfigException("warning.config.block.behavior.concrete.lack_solid_block", new NullPointerException("No `solid-block` specified for concrete powder block behavior")); + throw new LocalizedResourceConfigException("warning.config.block.behavior.concrete.missing_solid", new NullPointerException("No `solid-block` specified for concrete powder block behavior")); } return new ConcretePowderBlockBehavior(block, hurtAmount, hurtMax, Key.of(solidBlock)); } diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/CropBlockBehavior.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/CropBlockBehavior.java index d59d3e191..fc3ce5513 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/CropBlockBehavior.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/CropBlockBehavior.java @@ -172,7 +172,7 @@ public class CropBlockBehavior extends BushBlockBehavior { Tuple, Set, Set> tuple = readTagsAndState(arguments, false); Property ageProperty = (Property) block.getProperty("age"); if (ageProperty == null) { - throw new LocalizedResourceConfigException("warning.config.block.behavior.crop.lack_age", new IllegalArgumentException("age property not set for crop")); + throw new LocalizedResourceConfigException("warning.config.block.behavior.crop.missing_age", new IllegalArgumentException("age property not set for crop")); } int minGrowLight = ResourceConfigUtils.getAsInt(arguments.getOrDefault("light-requirement", 9), "light-requirement"); float growSpeed = ResourceConfigUtils.getAsFloat(arguments.getOrDefault("grow-speed", 0.125f), "grow-speed"); diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/LeavesBlockBehavior.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/LeavesBlockBehavior.java index dd12c44ec..2166e4bf8 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/LeavesBlockBehavior.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/LeavesBlockBehavior.java @@ -175,11 +175,11 @@ public class LeavesBlockBehavior extends WaterLoggedBlockBehavior { public BlockBehavior create(CustomBlock block, Map arguments) { Property persistent = (Property) block.getProperty("persistent"); if (persistent == null) { - throw new LocalizedResourceConfigException("warning.config.block.behavior.leaves.lack_persistent", new NullPointerException("persistent property not set for block " + block.id())); + throw new LocalizedResourceConfigException("warning.config.block.behavior.leaves.missing_persistent", new NullPointerException("persistent property not set for block " + block.id())); } Property distance = (Property) block.getProperty("distance"); if (distance == null) { - throw new LocalizedResourceConfigException("warning.config.block.behavior.leaves.lack_distance", new NullPointerException("distance property not set for block " + block.id())); + throw new LocalizedResourceConfigException("warning.config.block.behavior.leaves.missing_distance", new NullPointerException("distance property not set for block " + block.id())); } Property waterlogged = (Property) block.getProperty("waterlogged"); int actual = distance.possibleValues().get(distance.possibleValues().size() - 1); diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/SaplingBlockBehavior.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/SaplingBlockBehavior.java index cb0adde07..382619943 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/SaplingBlockBehavior.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/SaplingBlockBehavior.java @@ -140,11 +140,11 @@ public class SaplingBlockBehavior extends BushBlockBehavior { public BlockBehavior create(CustomBlock block, Map arguments) { String feature = (String) arguments.get("feature"); if (feature == null) { - throw new LocalizedResourceConfigException("warning.config.block.behavior.sapling.lack_feature", new IllegalArgumentException("'feature' is required for sapling block behavior")); + throw new LocalizedResourceConfigException("warning.config.block.behavior.sapling.missing_feature", new IllegalArgumentException("'feature' is required for sapling block behavior")); } Property stageProperty = (Property) block.getProperty("stage"); if (stageProperty == null) { - throw new LocalizedResourceConfigException("warning.config.block.behavior.sapling.lack_stage", new IllegalArgumentException("stage property not set for sapling")); + throw new LocalizedResourceConfigException("warning.config.block.behavior.sapling.missing_stage", new IllegalArgumentException("stage property not set for sapling")); } double boneMealSuccessChance = ResourceConfigUtils.getAsDouble(arguments.getOrDefault("bone-meal-success-chance", 0.45), "bone-meal-success-chance"); Tuple, Set, Set> tuple = readTagsAndState(arguments, false); diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/StrippableBlockBehavior.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/StrippableBlockBehavior.java index 785050033..c9353a1af 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/StrippableBlockBehavior.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/StrippableBlockBehavior.java @@ -27,7 +27,7 @@ public class StrippableBlockBehavior extends BukkitBlockBehavior { public BlockBehavior create(CustomBlock block, Map arguments) { String stripped = (String) arguments.get("stripped"); if (stripped == null) { - throw new LocalizedResourceConfigException("warning.config.block.behavior.strippable.lack_stripped", new IllegalArgumentException("'stripped' is required for strippable block behavior")); + throw new LocalizedResourceConfigException("warning.config.block.behavior.strippable.missing_stripped", new IllegalArgumentException("'stripped' is required for strippable block behavior")); } return new StrippableBlockBehavior(block, Key.of(stripped)); } diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/SugarCaneBlockBehavior.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/SugarCaneBlockBehavior.java index c77ce87fb..567ae07a0 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/SugarCaneBlockBehavior.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/SugarCaneBlockBehavior.java @@ -201,7 +201,7 @@ public class SugarCaneBlockBehavior extends BushBlockBehavior { Tuple, Set, Set> tuple = readTagsAndState(arguments, false); Property ageProperty = (Property) block.getProperty("age"); if (ageProperty == null) { - throw new LocalizedResourceConfigException("warning.config.block.behavior.sugar_cane.lack_age", new IllegalArgumentException("'age' property not set for sugar cane block behavior")); + throw new LocalizedResourceConfigException("warning.config.block.behavior.sugar_cane.missing_age", new IllegalArgumentException("'age' property not set for sugar cane block behavior")); } int maxHeight = ResourceConfigUtils.getAsInt(arguments.getOrDefault("max-height", 3), "max-height"); List nearbyLiquids = MiscUtils.getAsStringList(arguments.getOrDefault("required-adjacent-liquids", List.of())); diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/entity/furniture/BukkitFurnitureManager.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/entity/furniture/BukkitFurnitureManager.java index fea03cbee..faad973b1 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/entity/furniture/BukkitFurnitureManager.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/entity/furniture/BukkitFurnitureManager.java @@ -107,14 +107,14 @@ public class BukkitFurnitureManager extends AbstractFurnitureManager { @Override public void parseSection(Pack pack, Path path, Key id, Map section) { if (byId.containsKey(id)) { - throw new LocalizedResourceConfigException("warning.config.furniture.duplicated", path, id); + throw new LocalizedResourceConfigException("warning.config.furniture.duplicate", path, id); } Map lootMap = MiscUtils.castToMap(section.get("loot"), true); Map settingsMap = MiscUtils.castToMap(section.get("settings"), true); Map placementMap = MiscUtils.castToMap(section.get("placement"), true); if (placementMap == null) { - throw new LocalizedResourceConfigException("warning.config.furniture.lack_placement", path, id); + throw new LocalizedResourceConfigException("warning.config.furniture.missing_placement", path, id); } EnumMap placements = new EnumMap<>(AnchorType.class); @@ -130,7 +130,7 @@ public class BukkitFurnitureManager extends AbstractFurnitureManager { for (Map element : elementConfigs) { String key = (String) element.get("item"); if (key == null) { - throw new LocalizedResourceConfigException("warning.config.furniture.element.lack_item", path, id); + throw new LocalizedResourceConfigException("warning.config.furniture.element.missing_item", path, id); } ItemDisplayContext transform = ItemDisplayContext.valueOf(element.getOrDefault("transform", "NONE").toString().toUpperCase(Locale.ENGLISH)); Billboard billboard = Billboard.valueOf(element.getOrDefault("billboard", "FIXED").toString().toUpperCase(Locale.ENGLISH)); diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/BukkitItemManager.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/BukkitItemManager.java index 795f9d10f..da7f89f50 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/BukkitItemManager.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/BukkitItemManager.java @@ -240,7 +240,7 @@ public class BukkitItemManager extends AbstractItemManager { @Override public void parseSection(Pack pack, Path path, Key id, Map section) { if (customItems.containsKey(id)) { - throw new LocalizedResourceConfigException("warning.config.item.duplicated", path, id); + throw new LocalizedResourceConfigException("warning.config.item.duplicate", path, id); } // register for recipes @@ -253,7 +253,7 @@ public class BukkitItemManager extends AbstractItemManager { if (isVanillaItem) materialStringId = id.value(); if (materialStringId == null) { - throw new LocalizedResourceConfigException("warning.config.item.lack_material", path, id); + throw new LocalizedResourceConfigException("warning.config.item.missing_material", path, id); } Material material = MaterialUtils.getMaterial(materialStringId); @@ -395,14 +395,14 @@ public class BukkitItemManager extends AbstractItemManager { } if (customModelData > 16_777_216) { - throw new LocalizedResourceConfigException("warning.config.item.bad_custom_model_data_value", path, id, String.valueOf(customModelData)); + throw new LocalizedResourceConfigException("warning.config.item.bad_custom_model_data", path, id, String.valueOf(customModelData)); } conflict.put(customModelData, id); // Parse models for (ModelGeneration generation : model.modelsToGenerate()) { - prepareModelGeneration(path, id, generation); + prepareModelGeneration(generation); } if (Config.packMaxVersion() > 21.39f) { @@ -420,7 +420,7 @@ public class BukkitItemManager extends AbstractItemManager { if (itemModelKey != null) { hasModel = true; for (ModelGeneration generation : model.modelsToGenerate()) { - prepareModelGeneration(path, id, generation); + prepareModelGeneration(generation); } if (Config.packMaxVersion() > 21.39f) { @@ -439,7 +439,7 @@ public class BukkitItemManager extends AbstractItemManager { } } if (!hasModel) { - throw new LocalizedResourceConfigException("warning.config.item.lack_model_id", path, id); + throw new LocalizedResourceConfigException("warning.config.item.missing_model_id", path, id); } } } diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/behavior/BlockItemBehavior.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/behavior/BlockItemBehavior.java index 76e259402..847935ca0 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/behavior/BlockItemBehavior.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/behavior/BlockItemBehavior.java @@ -188,7 +188,7 @@ public class BlockItemBehavior extends ItemBehavior { public ItemBehavior create(Pack pack, Path path, Key key, Map arguments) { Object id = arguments.get("block"); if (id == null) { - throw new LocalizedResourceConfigException("warning.config.item.behavior.block.lack_block", new IllegalArgumentException("Missing required parameter 'block' for block_item behavior")); + throw new LocalizedResourceConfigException("warning.config.item.behavior.block.missing_block", new IllegalArgumentException("Missing required parameter 'block' for block_item behavior")); } if (id instanceof Map map) { if (map.containsKey(key.toString())) { diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/behavior/FurnitureItemBehavior.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/behavior/FurnitureItemBehavior.java index 219afd0cd..f61092a23 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/behavior/FurnitureItemBehavior.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/behavior/FurnitureItemBehavior.java @@ -155,7 +155,7 @@ public class FurnitureItemBehavior extends ItemBehavior { public ItemBehavior create(Pack pack, Path path, Key key, Map arguments) { Object id = arguments.get("furniture"); if (id == null) { - throw new LocalizedResourceConfigException("warning.config.item.behavior.furniture.lack_furniture", new IllegalArgumentException("Missing required parameter 'furniture' for furniture_item behavior")); + throw new LocalizedResourceConfigException("warning.config.item.behavior.furniture.missing_furniture", new IllegalArgumentException("Missing required parameter 'furniture' for furniture_item behavior")); } if (id instanceof Map map) { if (map.containsKey(key.toString())) { diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/behavior/LiquidCollisionBlockItemBehavior.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/behavior/LiquidCollisionBlockItemBehavior.java index f690e07a4..628dfa775 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/behavior/LiquidCollisionBlockItemBehavior.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/behavior/LiquidCollisionBlockItemBehavior.java @@ -65,7 +65,7 @@ public class LiquidCollisionBlockItemBehavior extends BlockItemBehavior { public ItemBehavior create(Pack pack, Path path, Key key, Map arguments) { Object id = arguments.get("block"); if (id == null) { - throw new LocalizedResourceConfigException("warning.config.item.behavior.liquid_collision_block.lack_block", new IllegalArgumentException("Missing required parameter 'block' for liquid_collision_block_item behavior")); + throw new LocalizedResourceConfigException("warning.config.item.behavior.liquid_collision.missing_block", new IllegalArgumentException("Missing required parameter 'block' for liquid_collision_block_item behavior")); } int offset = ResourceConfigUtils.getAsInt(arguments.getOrDefault("y-offset", 1), "y-offset"); if (id instanceof Map map) { diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/loot/BukkitVanillaLootManager.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/loot/BukkitVanillaLootManager.java index 19bc6bd07..0c22aa56c 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/loot/BukkitVanillaLootManager.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/loot/BukkitVanillaLootManager.java @@ -110,7 +110,7 @@ public class BukkitVanillaLootManager extends AbstractVanillaLootManager impleme public void parseSection(Pack pack, Path path, Key id, Map section) { String type = (String) section.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.vanilla_loot.type_not_exist", path, id); + throw new LocalizedResourceConfigException("warning.config.vanilla_loot.missing_type", path, id); } VanillaLoot.Type typeEnum = VanillaLoot.Type.valueOf(type.toUpperCase(Locale.ENGLISH)); boolean override = (boolean) section.getOrDefault("override", false); diff --git a/core/src/main/java/net/momirealms/craftengine/core/block/behavior/BlockBehaviors.java b/core/src/main/java/net/momirealms/craftengine/core/block/behavior/BlockBehaviors.java index 619336ee9..c220ec974 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/block/behavior/BlockBehaviors.java +++ b/core/src/main/java/net/momirealms/craftengine/core/block/behavior/BlockBehaviors.java @@ -25,14 +25,14 @@ public class BlockBehaviors { public static BlockBehavior fromMap(CustomBlock block, @Nullable Map map) { if (map == null) return EmptyBlockBehavior.INSTANCE; - String type = (String) map.getOrDefault("type", "empty"); + Object type = map.get("type"); if (type == null) { - throw new NullPointerException("behavior type cannot be null"); + throw new LocalizedResourceConfigException("warning.config.block.behavior.missing_type", new NullPointerException("behavior type cannot be null")); } - Key key = Key.withDefaultNamespace(type, "craftengine"); + Key key = Key.withDefaultNamespace(type.toString(), "craftengine"); BlockBehaviorFactory factory = BuiltInRegistries.BLOCK_BEHAVIOR_FACTORY.getValue(key); if (factory == null) { - throw new LocalizedResourceConfigException("warning.config.block.behavior.invalid_type", new IllegalArgumentException("Unknown block behavior type: " + type), type); + throw new LocalizedResourceConfigException("warning.config.block.behavior.invalid_type", new IllegalArgumentException("Unknown block behavior type: " + type), type.toString()); } return factory.create(block, map); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/block/properties/Properties.java b/core/src/main/java/net/momirealms/craftengine/core/block/properties/Properties.java index 0fae569ad..aabc93436 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/block/properties/Properties.java +++ b/core/src/main/java/net/momirealms/craftengine/core/block/properties/Properties.java @@ -37,7 +37,7 @@ public class Properties { public static Property fromMap(String name, Map map) { Object type = map.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.block.state.property.lack_type", new NullPointerException("'type' cannot be null for block state property"), name); + throw new LocalizedResourceConfigException("warning.config.block.state.property.missing_type", new NullPointerException("'type' cannot be null for block state property"), name); } Key key = Key.withDefaultNamespace(type.toString(), "craftengine"); PropertyFactory factory = BuiltInRegistries.PROPERTY_FACTORY.getValue(key); diff --git a/core/src/main/java/net/momirealms/craftengine/core/font/AbstractFontManager.java b/core/src/main/java/net/momirealms/craftengine/core/font/AbstractFontManager.java index d9fb200ad..3277303cf 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/font/AbstractFontManager.java +++ b/core/src/main/java/net/momirealms/craftengine/core/font/AbstractFontManager.java @@ -357,16 +357,16 @@ public abstract class AbstractFontManager implements FontManager { @Override public void parseSection(Pack pack, Path path, Key id, Map section) { if (emojis.containsKey(id)) { - throw new LocalizedResourceConfigException("warning.config.emoji.duplicated", path, id); + throw new LocalizedResourceConfigException("warning.config.emoji.duplicate", path, id); } String permission = (String) section.get("permission"); Object keywordsRaw = section.get("keywords"); if (keywordsRaw == null) { - throw new LocalizedResourceConfigException("warning.config.emoji.lack_keywords", path, id); + throw new LocalizedResourceConfigException("warning.config.emoji.missing_keywords", path, id); } List keywords = MiscUtils.getAsStringList(keywordsRaw); if (keywords.isEmpty()) { - throw new LocalizedResourceConfigException("warning.config.emoji.lack_keywords", path, id); + throw new LocalizedResourceConfigException("warning.config.emoji.missing_keywords", path, id); } String content = section.getOrDefault("content", "").toString(); String image = null; @@ -418,22 +418,22 @@ public abstract class AbstractFontManager implements FontManager { @Override public void parseSection(Pack pack, Path path, Key id, Map section) { if (images.containsKey(id)) { - throw new LocalizedResourceConfigException("warning.config.image.duplicated", path, id); + throw new LocalizedResourceConfigException("warning.config.image.duplicate", path, id); } Object file = section.get("file"); if (file == null) { - throw new LocalizedResourceConfigException("warning.config.image.lack_file", path, id); + throw new LocalizedResourceConfigException("warning.config.image.missing_file", path, id); } String resourceLocation = file.toString().replace("\\", "/"); if (!ResourceLocation.isValid(resourceLocation)) { - throw new LocalizedResourceConfigException("warning.config.image.invalid_resource_location", path, id, resourceLocation); + throw new LocalizedResourceConfigException("warning.config.image.invalid_file_chars", path, id, resourceLocation); } String fontName = (String) section.getOrDefault("font", "minecraft:default"); if (!ResourceLocation.isValid(fontName)) { - throw new LocalizedResourceConfigException("warning.config.image.invalid_font_name", path, id, fontName); + throw new LocalizedResourceConfigException("warning.config.image.invalid_font_chars", path, id, fontName); } Key fontKey = Key.withDefaultNamespace(fontName, id.namespace()); @@ -444,7 +444,7 @@ public abstract class AbstractFontManager implements FontManager { charsObj = section.get("char"); } if (charsObj == null) { - throw new LocalizedResourceConfigException("warning.config.image.lack_char", path, id); + throw new LocalizedResourceConfigException("warning.config.image.missing_char", path, id); } if (charsObj instanceof List list) { chars = MiscUtils.getAsStringList(list).stream().map(it -> { @@ -474,7 +474,7 @@ public abstract class AbstractFontManager implements FontManager { for (int codepoint : codepoints) { if (font.isCodepointInUse(codepoint)) { BitmapImage image = font.bitmapImageByCodepoint(codepoint); - throw new LocalizedResourceConfigException("warning.config.image.codepoint_in_use", path, id, + throw new LocalizedResourceConfigException("warning.config.image.codepoint_conflict", path, id, fontKey.toString(), CharacterUtils.encodeCharsToUnicode(Character.toChars(codepoint)), new String(Character.toChars(codepoint)), @@ -482,7 +482,7 @@ public abstract class AbstractFontManager implements FontManager { } } if (codepoints.length == 0) { - throw new LocalizedResourceConfigException("warning.config.image.lack_char", path, id); + throw new LocalizedResourceConfigException("warning.config.image.missing_char", path, id); } codepointGrid[i] = codepoints; if (size == -1) size = codepoints.length; @@ -502,7 +502,7 @@ public abstract class AbstractFontManager implements FontManager { .resolve(namespacedPath.value()); if (!Files.exists(targetImagePath)) { - TranslationManager.instance().log("warning.config.image.file_not_exist", path.toString(), id.toString(), targetImagePath.toString()); + TranslationManager.instance().log("warning.config.image.file_not_found", path.toString(), id.toString(), targetImagePath.toString()); // DO NOT RETURN, JUST GIVE WARNINGS } else if (heightObj == null) { try (InputStream in = Files.newInputStream(targetImagePath)) { @@ -515,13 +515,13 @@ public abstract class AbstractFontManager implements FontManager { } if (heightObj == null) { - throw new LocalizedResourceConfigException("warning.config.image.lack_height", path, id); + throw new LocalizedResourceConfigException("warning.config.image.missing_height", path, id); } int height = ResourceConfigUtils.getAsInt(heightObj, "height"); int ascent = ResourceConfigUtils.getAsInt(section.getOrDefault("ascent", height - 1), "ascent"); if (height < ascent) { - throw new LocalizedResourceConfigException("warning.config.image.height_smaller_than_ascent", path, id, String.valueOf(height), String.valueOf(ascent)); + throw new LocalizedResourceConfigException("warning.config.image.height_ascent_conflict", path, id, String.valueOf(height), String.valueOf(ascent)); } BitmapImage bitmapImage = new BitmapImage(id, fontKey, height, ascent, resourceLocation, codepointGrid); diff --git a/core/src/main/java/net/momirealms/craftengine/core/item/behavior/ItemBehaviors.java b/core/src/main/java/net/momirealms/craftengine/core/item/behavior/ItemBehaviors.java index 691ad0307..f092787cd 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/item/behavior/ItemBehaviors.java +++ b/core/src/main/java/net/momirealms/craftengine/core/item/behavior/ItemBehaviors.java @@ -24,7 +24,7 @@ public class ItemBehaviors { public static ItemBehavior fromMap(Pack pack, Path path, Key id, Map map) { Object type = map.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.item.behavior.lack_type", new NullPointerException("behavior type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.item.behavior.missing_type", new NullPointerException("behavior type cannot be null")); } Key key = Key.withDefaultNamespace(type.toString(), "craftengine"); ItemBehaviorFactory factory = BuiltInRegistries.ITEM_BEHAVIOR_FACTORY.getValue(key); diff --git a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/AbstractRecipeFactory.java b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/AbstractRecipeFactory.java index f19b239d9..1036a197e 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/AbstractRecipeFactory.java +++ b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/AbstractRecipeFactory.java @@ -38,7 +38,7 @@ public abstract class AbstractRecipeFactory implements RecipeFactory { ingredient = arguments.get("ingredients"); } if (ingredient == null) { - throw new LocalizedResourceConfigException("warning.config.recipe.lack_ingredient", new NullPointerException("'ingredient' should not be null")); + throw new LocalizedResourceConfigException("warning.config.recipe.missing_ingredient", new NullPointerException("'ingredient' should not be null")); } return ingredient; } diff --git a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/AbstractRecipeManager.java b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/AbstractRecipeManager.java index e8b3190ef..7220614c4 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/AbstractRecipeManager.java +++ b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/AbstractRecipeManager.java @@ -157,7 +157,7 @@ public abstract class AbstractRecipeManager implements RecipeManager { public void parseSection(Pack pack, Path path, Key id, Map section) { if (!Config.enableRecipeSystem()) return; if (AbstractRecipeManager.this.byId.containsKey(id)) { - throw new LocalizedResourceConfigException("warning.config.recipe.duplicated", path, id); + throw new LocalizedResourceConfigException("warning.config.recipe.duplicate", path, id); } Recipe recipe = RecipeTypes.fromMap(id, section); try { diff --git a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/CustomShapedRecipe.java b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/CustomShapedRecipe.java index 30cfccd46..bb96d8c9c 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/CustomShapedRecipe.java +++ b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/CustomShapedRecipe.java @@ -141,7 +141,7 @@ public class CustomShapedRecipe extends CustomCraftingTableRecipe { public Recipe create(Key id, Map arguments) { List pattern = MiscUtils.getAsStringList(arguments.get("pattern")); if (pattern.isEmpty()) { - throw new LocalizedResourceConfigException("warning.config.recipe.shaped.lack_pattern", new NullPointerException("'pattern' cannot be empty")); + throw new LocalizedResourceConfigException("warning.config.recipe.shaped.missing_pattern", new NullPointerException("'pattern' cannot be empty")); } if (!validatePattern(pattern)) { throw new LocalizedResourceConfigException("warning.config.recipe.shaped.invalid_pattern", new IllegalArgumentException("Invalid pattern: " + pattern), pattern.toString()); diff --git a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/CustomSmithingTransformRecipe.java b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/CustomSmithingTransformRecipe.java index 7f2c7d2f5..892ebd919 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/CustomSmithingTransformRecipe.java +++ b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/CustomSmithingTransformRecipe.java @@ -182,7 +182,7 @@ public class CustomSmithingTransformRecipe implements Recipe { public static ItemDataProcessor fromMap(Map map) { String type = (String) map.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.recipe.smithing_transform.post_processor.lack_type", new NullPointerException("Missing required parameter 'type' for post processor")); + throw new LocalizedResourceConfigException("warning.config.recipe.smithing_transform.post_processor.missing_type", new NullPointerException("Missing required parameter 'type' for post processor")); } Key key = Key.withDefaultNamespace(type, "craftengine"); ItemDataProcessor.Factory factory = BuiltInRegistries.SMITHING_RESULT_PROCESSOR_FACTORY.getValue(key); @@ -237,7 +237,7 @@ public class CustomSmithingTransformRecipe implements Recipe { public ItemDataProcessor create(Map arguments) { Object componentsObj = arguments.get("components"); if (componentsObj == null) { - throw new LocalizedResourceConfigException("warning.config.recipe.smithing_transform.post_processor.keep_component.lack_components", new NullPointerException("Missing required parameter 'components' for post processor")); + throw new LocalizedResourceConfigException("warning.config.recipe.smithing_transform.post_processor.keep_component.missing_components", new NullPointerException("Missing required parameter 'components' for post processor")); } List components = MiscUtils.getAsStringList(componentsObj); return new KeepComponents(components.stream().map(Key::of).toList()); @@ -274,7 +274,7 @@ public class CustomSmithingTransformRecipe implements Recipe { public ItemDataProcessor create(Map arguments) { Object tagsObj = arguments.get("tags"); if (tagsObj == null) { - throw new LocalizedResourceConfigException("warning.config.recipe.smithing_transform.post_processor.keep_component.lack_tags", new NullPointerException("Missing required parameter 'tags' for post processor")); + throw new LocalizedResourceConfigException("warning.config.recipe.smithing_transform.post_processor.keep_component.missing_tags", new NullPointerException("Missing required parameter 'tags' for post processor")); } List tags = MiscUtils.getAsStringList(tagsObj); return new KeepTags(tags.stream().map(it -> it.split("\\.")).toList()); diff --git a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/RecipeFactory.java b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/RecipeFactory.java index 8a9bd1ae0..c42a28520 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/RecipeFactory.java +++ b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/RecipeFactory.java @@ -16,11 +16,11 @@ public interface RecipeFactory { default CustomRecipeResult parseResult(Map arguments) { Map resultMap = MiscUtils.castToMap(arguments.get("result"), true); if (resultMap == null) { - throw new LocalizedResourceConfigException("warning.config.recipe.lack_result", new IllegalArgumentException("result cannot be empty for recipe")); + throw new LocalizedResourceConfigException("warning.config.recipe.missing_result", new IllegalArgumentException("result cannot be empty for recipe")); } String id = (String) resultMap.get("id"); if (id == null) { - throw new LocalizedResourceConfigException("warning.config.recipe.result.lack_id", new IllegalArgumentException("id cannot be empty for result")); + throw new LocalizedResourceConfigException("warning.config.recipe.result.missing_id", new IllegalArgumentException("id cannot be empty for result")); } int count = ResourceConfigUtils.getAsInt(resultMap.getOrDefault("count", 1), "count"); return new CustomRecipeResult( diff --git a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/RecipeTypes.java b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/RecipeTypes.java index 4061a266f..5a6cd0255 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/RecipeTypes.java +++ b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/RecipeTypes.java @@ -42,7 +42,7 @@ public class RecipeTypes { public static Recipe fromMap(Key id, Map map) { String type = (String) map.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.recipe.lack_type", new NullPointerException("'type' cannot be null for recipe")); + throw new LocalizedResourceConfigException("warning.config.recipe.missing_type", new NullPointerException("'type' cannot be null for recipe")); } Key key = Key.withDefaultNamespace(type, "minecraft"); RecipeFactory factory = (RecipeFactory) BuiltInRegistries.RECIPE_FACTORY.getValue(key); diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/LootTable.java b/core/src/main/java/net/momirealms/craftengine/core/loot/LootTable.java index f5d197fa0..9f98469cd 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/LootTable.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/LootTable.java @@ -42,10 +42,10 @@ public class LootTable { if (map == null || map.isEmpty()) return null; Object pools = map.get("pools"); if (pools == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.lack_pools"); + throw new LocalizedResourceConfigException("warning.config.loot_table.missing_pools"); } if (!(pools instanceof List list) || list.isEmpty()) { - throw new LocalizedResourceConfigException("warning.config.loot_table.wrong_pools_type", pools.getClass().getSimpleName()); + throw new LocalizedResourceConfigException("warning.config.loot_table.invalid_pools_type", pools.getClass().getSimpleName()); } List poolList = (List) map.get("pools"); List> lootPools = new ArrayList<>(); @@ -56,15 +56,15 @@ public class LootTable { NumberProvider bonus_rolls = NumberProviders.fromObject(pool.getOrDefault("bonus_rolls", 0)); List conditions = Optional.ofNullable(pool.get("conditions")) .map(it -> LootConditions.fromMapList(castToMapListOrThrow(it, - () -> new LocalizedResourceConfigException("warning.config.loot_table.wrong_conditions_type", new RuntimeException("'conditions' should be a map list, current type: " + it.getClass().getSimpleName()), it.getClass().getSimpleName())))) + () -> new LocalizedResourceConfigException("warning.config.loot_table.invalid_conditions_type", new RuntimeException("'conditions' should be a map list, current type: " + it.getClass().getSimpleName()), it.getClass().getSimpleName())))) .orElse(Lists.newArrayList()); List> containers = Optional.ofNullable(pool.get("entries")) .map(it -> (List>) new ArrayList>(LootEntryContainers.fromMapList(castToMapListOrThrow(it, - () -> new LocalizedResourceConfigException("warning.config.loot_table.wrong_entries_type", new RuntimeException("'entries' should be a map list, current type: " + it.getClass().getSimpleName()), it.getClass().getSimpleName()))))) + () -> new LocalizedResourceConfigException("warning.config.loot_table.invalid_entries_type", new RuntimeException("'entries' should be a map list, current type: " + it.getClass().getSimpleName()), it.getClass().getSimpleName()))))) .orElse(Lists.newArrayList()); List> functions = Optional.ofNullable(pool.get("functions")) .map(it -> (List>) new ArrayList>(LootFunctions.fromMapList(castToMapListOrThrow(it, - () -> new LocalizedResourceConfigException("warning.config.loot_table.wrong_functions_type", new RuntimeException("'functions' should be a map list, current type: " + it.getClass().getSimpleName()), it.getClass().getSimpleName()))))) + () -> new LocalizedResourceConfigException("warning.config.loot_table.invalid_functions_type", new RuntimeException("'functions' should be a map list, current type: " + it.getClass().getSimpleName()), it.getClass().getSimpleName()))))) .orElse(Lists.newArrayList()); lootPools.add(new LootPool<>(containers, conditions, functions, rolls, bonus_rolls)); } else if (rawPool instanceof String string) { @@ -76,7 +76,7 @@ public class LootTable { return new LootTable<>(lootPools, Optional.ofNullable(map.get("functions")) .map(it -> (List>) new ArrayList>(LootFunctions.fromMapList(castToMapListOrThrow(it, - () -> new LocalizedResourceConfigException("warning.config.loot_table.wrong_functions_type", new RuntimeException("'functions' should be a map list, current type: " + it.getClass().getSimpleName()), it.getClass().getSimpleName()))))) + () -> new LocalizedResourceConfigException("warning.config.loot_table.invalid_functions_type", new RuntimeException("'functions' should be a map list, current type: " + it.getClass().getSimpleName()), it.getClass().getSimpleName()))))) .orElse(Lists.newArrayList()) ); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/condition/LootConditions.java b/core/src/main/java/net/momirealms/craftengine/core/loot/condition/LootConditions.java index b3a3c0ef7..6c8b80008 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/condition/LootConditions.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/condition/LootConditions.java @@ -90,7 +90,7 @@ public class LootConditions { public static LootCondition fromMap(Map map) { String type = (String) map.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.condition.lack_type", new NullPointerException("condition type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.loot_table.condition.missing_type", new NullPointerException("condition type cannot be null")); } Key key = Key.withDefaultNamespace(type, "craftengine"); LootConditionFactory factory = BuiltInRegistries.LOOT_CONDITION_FACTORY.getValue(key); diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/condition/TableBonusCondition.java b/core/src/main/java/net/momirealms/craftengine/core/loot/condition/TableBonusCondition.java index 28afe190e..e71358c1d 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/condition/TableBonusCondition.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/condition/TableBonusCondition.java @@ -42,7 +42,7 @@ public class TableBonusCondition implements LootCondition { public LootCondition create(Map arguments) { Object enchantmentObj = arguments.get("enchantment"); if (enchantmentObj == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.condition.table_bonus.lack_enchantment", new NullPointerException("'enchantment' should not be null for table bonus")); + throw new LocalizedResourceConfigException("warning.config.loot_table.condition.table_bonus.missing_enchantment"); } Key enchantmentType = Key.of(enchantmentObj.toString()); Object chances = arguments.get("chances"); @@ -57,7 +57,7 @@ public class TableBonusCondition implements LootCondition { return new TableBonusCondition(enchantmentType, values); } } - throw new LocalizedResourceConfigException("warning.config.loot_table.condition.table_bonus.lack_chances", new NullPointerException("'chances' should not be null for table bonus")); + throw new LocalizedResourceConfigException("warning.config.loot_table.condition.table_bonus.missing_chances"); } } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/entry/ExpLootEntryContainer.java b/core/src/main/java/net/momirealms/craftengine/core/loot/entry/ExpLootEntryContainer.java index 46571a824..737a65aef 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/entry/ExpLootEntryContainer.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/entry/ExpLootEntryContainer.java @@ -46,7 +46,7 @@ public class ExpLootEntryContainer extends AbstractLootEntryContainer { public LootEntryContainer create(Map arguments) { Object value = arguments.get("count"); if (value == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.entry.exp.lack_count", new IllegalArgumentException("'count' is required for exp entry")); + throw new LocalizedResourceConfigException("warning.config.loot_table.entry.exp.missing_count", new IllegalArgumentException("'count' is required for exp entry")); } List conditions = Optional.ofNullable(arguments.get("conditions")) .map(it -> LootConditions.fromMapList((List>) it)) diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/entry/LootEntryContainers.java b/core/src/main/java/net/momirealms/craftengine/core/loot/entry/LootEntryContainers.java index 66e315c0d..63f7258c7 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/entry/LootEntryContainers.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/entry/LootEntryContainers.java @@ -42,7 +42,7 @@ public class LootEntryContainers { public static LootEntryContainer fromMap(Map map) { String type = (String) map.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.entry.lack_type", new NullPointerException("loot entry type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.loot_table.entry.missing_type", new NullPointerException("loot entry type cannot be null")); } Key key = Key.withDefaultNamespace(type, "craftengine"); LootEntryContainerFactory factory = (LootEntryContainerFactory) BuiltInRegistries.LOOT_ENTRY_CONTAINER_FACTORY.getValue(key); diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/entry/SingleItemLootEntryContainer.java b/core/src/main/java/net/momirealms/craftengine/core/loot/entry/SingleItemLootEntryContainer.java index cf4d9a6ad..bf4e16afa 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/entry/SingleItemLootEntryContainer.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/entry/SingleItemLootEntryContainer.java @@ -45,7 +45,7 @@ public class SingleItemLootEntryContainer extends AbstractSingleLootEntryCont public LootEntryContainer create(Map arguments) { Object itemObj = arguments.get("item"); if (itemObj == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.entry.item.lack_item", new IllegalArgumentException("'item' is required for item entry")); + throw new LocalizedResourceConfigException("warning.config.loot_table.entry.item.missing_item", new IllegalArgumentException("'item' is required for item entry")); } Key item = Key.from(itemObj.toString()); int weight = (int) arguments.getOrDefault("weight", 1); diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/function/ApplyBonusCountFunction.java b/core/src/main/java/net/momirealms/craftengine/core/loot/function/ApplyBonusCountFunction.java index 2801cf7da..28c57055a 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/function/ApplyBonusCountFunction.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/function/ApplyBonusCountFunction.java @@ -51,11 +51,11 @@ public class ApplyBonusCountFunction extends AbstractLootConditionalFunction< public LootFunction create(Map arguments) { String enchantment = (String) arguments.get("enchantment"); if (enchantment == null || enchantment.isEmpty()) { - throw new LocalizedResourceConfigException("warning.config.loot_table.function.apply_bonus.lack_enchantment", new IllegalArgumentException("'enchantment' is required for apply_bonus function")); + throw new LocalizedResourceConfigException("warning.config.loot_table.function.apply_bonus.missing_enchantment", new IllegalArgumentException("'enchantment' is required for apply_bonus function")); } Map formulaMap = MiscUtils.castToMap(arguments.get("formula"), true); if (formulaMap == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.function.apply_bonus.lack_formula", new IllegalArgumentException("formula is required")); + throw new LocalizedResourceConfigException("warning.config.loot_table.function.apply_bonus.missing_formula", new IllegalArgumentException("formula is required")); } List conditions = Optional.ofNullable(arguments.get("conditions")) .map(it -> LootConditions.fromMapList((List>) it)) diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/function/DropExpFunction.java b/core/src/main/java/net/momirealms/craftengine/core/loot/function/DropExpFunction.java index 71a6b3f66..46504bff4 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/function/DropExpFunction.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/function/DropExpFunction.java @@ -42,7 +42,7 @@ public class DropExpFunction extends AbstractLootConditionalFunction { public LootFunction create(Map arguments) { Object value = arguments.get("count"); if (value == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.function.drop_exp.lack_count", new IllegalArgumentException("'count' is required for drop_exp function")); + throw new LocalizedResourceConfigException("warning.config.loot_table.function.drop_exp.missing_count", new IllegalArgumentException("'count' is required for drop_exp function")); } List conditions = Optional.ofNullable(arguments.get("conditions")) .map(it -> LootConditions.fromMapList((List>) it)) diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/function/LootFunctions.java b/core/src/main/java/net/momirealms/craftengine/core/loot/function/LootFunctions.java index 4d8441a89..b40d1b590 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/function/LootFunctions.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/function/LootFunctions.java @@ -70,7 +70,7 @@ public class LootFunctions { public static LootFunction fromMap(Map map) { String type = (String) map.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.function.lack_type", new NullPointerException("function type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.loot_table.function.missing_type", new NullPointerException("function type cannot be null")); } Key key = Key.withDefaultNamespace(type, "craftengine"); LootFunctionFactory factory = (LootFunctionFactory) BuiltInRegistries.LOOT_FUNCTION_FACTORY.getValue(key); diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/function/SetCountFunction.java b/core/src/main/java/net/momirealms/craftengine/core/loot/function/SetCountFunction.java index 01d45d70f..2f5d5d3e1 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/function/SetCountFunction.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/function/SetCountFunction.java @@ -44,7 +44,7 @@ public class SetCountFunction extends AbstractLootConditionalFunction { public LootFunction create(Map arguments) { Object value = arguments.get("count"); if (value == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.function.set_count.lack_count", new IllegalArgumentException("'count' is required for set_count function")); + throw new LocalizedResourceConfigException("warning.config.loot_table.function.set_count.missing_count", new IllegalArgumentException("'count' is required for set_count function")); } boolean add = (boolean) arguments.getOrDefault("add", false); List conditions = Optional.ofNullable(arguments.get("conditions")) diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/number/NumberProviders.java b/core/src/main/java/net/momirealms/craftengine/core/loot/number/NumberProviders.java index 277a9be23..b56361b00 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/number/NumberProviders.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/number/NumberProviders.java @@ -39,7 +39,7 @@ public class NumberProviders { public static NumberProvider fromMap(Map map) { String type = (String) map.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.number.lack_type", new NullPointerException("number type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.loot_table.number.missing_type", new NullPointerException("number type cannot be null")); } Key key = Key.withDefaultNamespace(type, "craftengine"); NumberProviderFactory factory = BuiltInRegistries.NUMBER_PROVIDER_FACTORY.getValue(key); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/AbstractPackManager.java b/core/src/main/java/net/momirealms/craftengine/core/pack/AbstractPackManager.java index 62c7d97fd..be0ddac75 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/AbstractPackManager.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/AbstractPackManager.java @@ -460,7 +460,7 @@ public abstract class AbstractPackManager implements PackManager { parser.parseSection(cached.pack(), cached.filePath(), id, plugin.templateManager().applyTemplates(configSection1)); } } else { - TranslationManager.instance().log("warning.config.not_a_section", cached.filePath().toString(), cached.prefix() + "." + key, configEntry.getValue().getClass().getSimpleName()); + TranslationManager.instance().log("warning.config.structure.not_section", cached.filePath().toString(), cached.prefix() + "." + key, configEntry.getValue().getClass().getSimpleName()); } } } catch (LocalizedException e) { diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/ExactPathMatcher.java b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/ExactPathMatcher.java index 760e843e6..5e833b6a4 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/ExactPathMatcher.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/ExactPathMatcher.java @@ -29,11 +29,11 @@ public class ExactPathMatcher implements PathMatcher { @Override public PathMatcher create(Map arguments) { - String path = (String) arguments.get("path"); + Object path = arguments.get("path"); if (path == null) { - throw new LocalizedResourceConfigException("warning.config.conflict_matcher.exact.lack_path", new IllegalArgumentException("The 'path' argument must not be null")); + throw new LocalizedResourceConfigException("warning.config.conflict_matcher.exact.missing_path", new IllegalArgumentException("The 'path' argument must not be null")); } - return new ExactPathMatcher(path); + return new ExactPathMatcher(path.toString()); } } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/FilenameMatcher.java b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/FilenameMatcher.java index 81680e45f..d43c76820 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/FilenameMatcher.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/FilenameMatcher.java @@ -29,11 +29,11 @@ public class FilenameMatcher implements PathMatcher { @Override public PathMatcher create(Map arguments) { - String name = (String) arguments.get("name"); + Object name = arguments.get("name"); if (name == null) { - throw new LocalizedResourceConfigException("warning.config.conflict_matcher.filename.lack_name", new IllegalArgumentException("The 'name' argument must not be null")); + throw new LocalizedResourceConfigException("warning.config.conflict_matcher.filename.missing_name", new IllegalArgumentException("The 'name' argument must not be null")); } - return new FilenameMatcher(name); + return new FilenameMatcher(name.toString()); } } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/ParentPathPrefixMatcher.java b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/ParentPathPrefixMatcher.java index 3322f27ff..79aace065 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/ParentPathPrefixMatcher.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/ParentPathPrefixMatcher.java @@ -31,11 +31,11 @@ public class ParentPathPrefixMatcher implements PathMatcher { @Override public PathMatcher create(Map arguments) { - String prefix = (String) arguments.get("prefix"); + Object prefix = arguments.get("prefix"); if (prefix == null) { - throw new LocalizedResourceConfigException("warning.config.conflict_matcher.parent_path_prefix.lack_prefix", new IllegalArgumentException("The prefix argument must not be null")); + throw new LocalizedResourceConfigException("warning.config.conflict_matcher.parent_prefix.missing_prefix", new IllegalArgumentException("The prefix argument must not be null")); } - return new ParentPathPrefixMatcher(prefix); + return new ParentPathPrefixMatcher(prefix.toString()); } } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/ParentPathSuffixMatcher.java b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/ParentPathSuffixMatcher.java index 4aec62815..47f914a57 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/ParentPathSuffixMatcher.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/ParentPathSuffixMatcher.java @@ -31,11 +31,11 @@ public class ParentPathSuffixMatcher implements PathMatcher { @Override public PathMatcher create(Map arguments) { - String suffix = (String) arguments.get("suffix"); + Object suffix = arguments.get("suffix"); if (suffix == null) { - throw new LocalizedResourceConfigException("warning.config.conflict_matcher.parent_path_suffix.lack_suffix", new IllegalArgumentException("The suffix argument must not be null")); + throw new LocalizedResourceConfigException("warning.config.conflict_matcher.parent_suffix.missing_suffix"); } - return new ParentPathSuffixMatcher(suffix); + return new ParentPathSuffixMatcher(suffix.toString()); } } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathContainsMatcher.java b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathContainsMatcher.java index ea3d986bd..28dbc39c1 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathContainsMatcher.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathContainsMatcher.java @@ -29,11 +29,11 @@ public class PathContainsMatcher implements PathMatcher { @Override public PathMatcher create(Map arguments) { - String path = (String) arguments.get("path"); + Object path = arguments.get("path"); if (path == null) { - throw new LocalizedResourceConfigException("warning.config.conflict_matcher.contains.lack_path", new NullPointerException("path should not be null")); + throw new LocalizedResourceConfigException("warning.config.conflict_matcher.contains.missing_path", new NullPointerException("path should not be null")); } - return new PathContainsMatcher(path); + return new PathContainsMatcher(path.toString()); } } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathMatchers.java b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathMatchers.java index 781a0e16c..eef970569 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathMatchers.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathMatchers.java @@ -51,7 +51,7 @@ public class PathMatchers { public static PathMatcher fromMap(Map map) { String type = (String) map.getOrDefault("type", "empty"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.conflict_matcher.lack_type", new NullPointerException("path matcher type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.conflict_matcher.missing_type", new NullPointerException("path matcher type cannot be null")); } Key key = Key.withDefaultNamespace(type, "craftengine"); PathMatcherFactory factory = BuiltInRegistries.PATH_MATCHER_FACTORY.getValue(key); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathPatternMatcher.java b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathPatternMatcher.java index 5ec39b080..8cac9a51d 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathPatternMatcher.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathPatternMatcher.java @@ -29,11 +29,11 @@ public class PathPatternMatcher implements PathMatcher { @Override public PathMatcher create(Map arguments) { - String pattern = (String) arguments.get("pattern"); + Object pattern = arguments.get("pattern"); if (pattern == null) { - throw new LocalizedResourceConfigException("warning.config.conflict_matcher.pattern.lack_pattern", new IllegalArgumentException("The pattern argument must not be null")); + throw new LocalizedResourceConfigException("warning.config.conflict_matcher.pattern.missing_pattern", new IllegalArgumentException("The pattern argument must not be null")); } - return new PathPatternMatcher(pattern); + return new PathPatternMatcher(pattern.toString()); } } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/resolution/Resolutions.java b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/resolution/Resolutions.java index 24d2e33f5..fe696661c 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/resolution/Resolutions.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/resolution/Resolutions.java @@ -33,12 +33,12 @@ public class Resolutions { public static Resolution fromMap(Map map) { String type = (String) map.getOrDefault("type", "empty"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.conflict_resolution.lack_type", new NullPointerException("path matcher type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.conflict_resolution.missing_type"); } Key key = Key.withDefaultNamespace(type, "craftengine"); ResolutionFactory factory = BuiltInRegistries.RESOLUTION_FACTORY.getValue(key); if (factory == null) { - throw new LocalizedResourceConfigException("warning.config.conflict_resolution.invalid_type", new IllegalArgumentException("Unknown matcher type: " + type), type); + throw new LocalizedResourceConfigException("warning.config.conflict_resolution.invalid_type", type); } return factory.create(map); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/host/ResourcePackHostFactory.java b/core/src/main/java/net/momirealms/craftengine/core/pack/host/ResourcePackHostFactory.java index b77439841..323004431 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/host/ResourcePackHostFactory.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/host/ResourcePackHostFactory.java @@ -16,12 +16,12 @@ public interface ResourcePackHostFactory { if (proxySetting != null) { Object hostObj = proxySetting.get("host"); if (hostObj == null) { - throw new LocalizedException("warning.config.host.proxy.lack_host", new NullPointerException("'host' should not be null for proxy setting")); + throw new LocalizedException("warning.config.host.proxy.missing_host", new NullPointerException("'host' should not be null for proxy setting")); } String proxyHost = hostObj.toString(); Object portObj = proxySetting.get("port"); if (portObj == null) { - throw new LocalizedException("warning.config.host.proxy.lack_port", new NullPointerException("'port' should not be null for proxy setting")); + throw new LocalizedException("warning.config.host.proxy.missing_port", new NullPointerException("'port' should not be null for proxy setting")); } int proxyPort = ResourceConfigUtils.getAsInt(portObj, "port"); if (proxyHost == null || proxyHost.isEmpty() || proxyPort <= 0 || proxyPort > 65535) { diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/host/ResourcePackHosts.java b/core/src/main/java/net/momirealms/craftengine/core/pack/host/ResourcePackHosts.java index 3db5b1c4a..8421c62c8 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/host/ResourcePackHosts.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/host/ResourcePackHosts.java @@ -43,7 +43,7 @@ public class ResourcePackHosts { public static ResourcePackHost fromMap(Map map) { String type = (String) map.get("type"); if (type == null) { - throw new LocalizedException("warning.config.host.external.lack_url"); + throw new LocalizedException("warning.config.host.missing_type"); } Key key = Key.withDefaultNamespace(type, "craftengine"); ResourcePackHostFactory factory = BuiltInRegistries.RESOURCE_PACK_HOST_FACTORY.getValue(key); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/AlistHost.java b/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/AlistHost.java index ea0b1a8a7..e86d71c90 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/AlistHost.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/AlistHost.java @@ -294,22 +294,22 @@ public class AlistHost implements ResourcePackHost { boolean useEnv = (boolean) arguments.getOrDefault("use-environment-variables", false); String apiUrl = (String) arguments.get("api-url"); if (apiUrl == null || apiUrl.isEmpty()) { - throw new LocalizedException("warning.config.host.alist.lack_api_url"); + throw new LocalizedException("warning.config.host.alist.missing_api_url"); } String userName = useEnv ? System.getenv("CE_ALIST_USERNAME") : (String) arguments.get("username"); if (userName == null || userName.isEmpty()) { - throw new LocalizedException("warning.config.host.alist.lack_username"); + throw new LocalizedException("warning.config.host.alist.missing_username"); } String password = useEnv ? System.getenv("CE_ALIST_PASSWORD") : (String) arguments.get("password"); if (password == null || password.isEmpty()) { - throw new LocalizedException("warning.config.host.alist.lack_password"); + throw new LocalizedException("warning.config.host.alist.missing_password"); } String filePassword = useEnv ? System.getenv("CE_ALIST_FILE_PASSWORD") : (String) arguments.getOrDefault("file-password", ""); String otpCode = (String) arguments.get("otp-code"); Duration jwtTokenExpiration = Duration.ofHours((int) arguments.getOrDefault("jwt-token-expiration", 48)); String uploadPath = (String) arguments.get("upload-path"); if (uploadPath == null || uploadPath.isEmpty()) { - throw new LocalizedException("warning.config.host.alist.lack_upload_path"); + throw new LocalizedException("warning.config.host.alist.missing_upload_path"); } boolean disableUpload = (boolean) arguments.getOrDefault("disable-upload", false); ProxySelector proxy = getProxySelector(MiscUtils.castToMap(arguments.get("proxy"), true)); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/DropboxHost.java b/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/DropboxHost.java index 9c8fc306e..ff0e64b2e 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/DropboxHost.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/DropboxHost.java @@ -269,19 +269,19 @@ public class DropboxHost implements ResourcePackHost { boolean useEnv = (boolean) arguments.getOrDefault("use-environment-variables", false); String appKey = useEnv ? System.getenv("CE_DROPBOX_APP_KEY") : (String) arguments.get("app-key"); if (appKey == null || appKey.isEmpty()) { - throw new LocalizedException("warning.config.host.dropbox.lack_app_key"); + throw new LocalizedException("warning.config.host.dropbox.missing_app_key"); } String appSecret = useEnv ? System.getenv("CE_DROPBOX_APP_SECRET") : (String) arguments.get("app-secret"); if (appSecret == null || appSecret.isEmpty()) { - throw new LocalizedException("warning.config.host.dropbox.lack_app_secret"); + throw new LocalizedException("warning.config.host.dropbox.missing_app_secret"); } String refreshToken = useEnv ? System.getenv("CE_DROPBOX_REFRESH_TOKEN") : (String) arguments.get("refresh-token"); if (refreshToken == null || refreshToken.isEmpty()) { - throw new LocalizedException("warning.config.host.dropbox.lack_refresh_token"); + throw new LocalizedException("warning.config.host.dropbox.missing_refresh_token"); } String uploadPath = (String) arguments.get("upload-path"); if (uploadPath == null || uploadPath.isEmpty()) { - throw new LocalizedException("warning.config.host.dropbox.lack_upload_path"); + throw new LocalizedException("warning.config.host.dropbox.missing_upload_path"); } ProxySelector proxy = getProxySelector(MiscUtils.castToMap(arguments.get("proxy"), true)); return new DropboxHost(appKey, appSecret, refreshToken, "/" + uploadPath, proxy); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/ExternalHost.java b/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/ExternalHost.java index a57bae861..ac7b9628f 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/ExternalHost.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/ExternalHost.java @@ -47,7 +47,7 @@ public class ExternalHost implements ResourcePackHost { public ResourcePackHost create(Map arguments) { String url = (String) arguments.get("url"); if (url == null || url.isEmpty()) { - throw new LocalizedException("warning.config.host.external.lack_url"); + throw new LocalizedException("warning.config.host.external.missing_url"); } String uuid = (String) arguments.get("uuid"); if (uuid == null || uuid.isEmpty()) { diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/GitLabHost.java b/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/GitLabHost.java index f70f37069..d53024fcc 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/GitLabHost.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/GitLabHost.java @@ -179,18 +179,18 @@ public class GitLabHost implements ResourcePackHost { boolean useEnv = (boolean) arguments.getOrDefault("use-environment-variables", false); String gitlabUrl = (String) arguments.get("gitlab-url"); if (gitlabUrl == null || gitlabUrl.isEmpty()) { - throw new LocalizedException("warning.config.host.gitlab.lack_url"); + throw new LocalizedException("warning.config.host.gitlab.missing_url"); } if (gitlabUrl.endsWith("/")) { gitlabUrl = gitlabUrl.substring(0, gitlabUrl.length() - 1); } String accessToken = useEnv ? System.getenv("CE_GITLAB_ACCESS_TOKEN") : (String) arguments.get("access-token"); if (accessToken == null || accessToken.isEmpty()) { - throw new LocalizedException("warning.config.host.gitlab.lack_access_token"); + throw new LocalizedException("warning.config.host.gitlab.missing_token"); } String projectId = (String) arguments.get("project-id"); if (projectId == null || projectId.isEmpty()) { - throw new LocalizedException("warning.config.host.gitlab.lack_project_id"); + throw new LocalizedException("warning.config.host.gitlab.missing_project"); } projectId = URLEncoder.encode(projectId, StandardCharsets.UTF_8).replace("/", "%2F"); ProxySelector proxy = getProxySelector(MiscUtils.castToMap(arguments.get("proxy"), true)); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/LobFileHost.java b/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/LobFileHost.java index 3ff6f9e51..d598bc636 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/LobFileHost.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/LobFileHost.java @@ -274,7 +274,7 @@ public class LobFileHost implements ResourcePackHost { boolean useEnv = (boolean) arguments.getOrDefault("use-environment-variables", false); String apiKey = useEnv ? System.getenv("CE_LOBFILE_API_KEY") : (String) arguments.get("api-key"); if (apiKey == null || apiKey.isEmpty()) { - throw new LocalizedException("warning.config.host.lobfile.lack_api_key"); + throw new LocalizedException("warning.config.host.lobfile.missing_api_key"); } ProxySelector proxy = getProxySelector(MiscUtils.castToMap(arguments.get("proxy"), true)); return new LobFileHost(apiKey, proxy); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/OneDriveHost.java b/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/OneDriveHost.java index fda092d7a..8cb253436 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/OneDriveHost.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/OneDriveHost.java @@ -234,19 +234,19 @@ public class OneDriveHost implements ResourcePackHost { boolean useEnv = (boolean) arguments.getOrDefault("use-environment-variables", false); String clientId = useEnv ? System.getenv("CE_ONEDRIVE_CLIENT_ID") : (String) arguments.get("client-id"); if (clientId == null || clientId.isEmpty()) { - throw new LocalizedException("warning.config.host.onedrive.lack_client_id"); + throw new LocalizedException("warning.config.host.onedrive.missing_client_id"); } String clientSecret = useEnv ? System.getenv("CE_ONEDRIVE_CLIENT_SECRET") : (String) arguments.get("client-secret"); if (clientSecret == null || clientSecret.isEmpty()) { - throw new LocalizedException("warning.config.host.onedrive.lack_client_secret"); + throw new LocalizedException("warning.config.host.onedrive.missing_client_secret"); } String refreshToken = useEnv ? System.getenv("CE_ONEDRIVE_REFRESH_TOKEN") : (String) arguments.get("refresh-token"); if (refreshToken == null || refreshToken.isEmpty()) { - throw new LocalizedException("warning.config.host.onedrive.lack_refresh_token"); + throw new LocalizedException("warning.config.host.onedrive.missing_refresh_token"); } String uploadPath = (String) arguments.getOrDefault("upload-path", "resource_pack.zip"); if (uploadPath == null || uploadPath.isEmpty()) { - throw new LocalizedException("warning.config.host.onedrive.lack_upload_path"); + throw new LocalizedException("warning.config.host.onedrive.missing_upload_path"); } ProxySelector proxy = getProxySelector(MiscUtils.castToMap(arguments.get("proxy"), true)); return new OneDriveHost(clientId, clientSecret, refreshToken, uploadPath, proxy); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/S3Host.java b/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/S3Host.java index 176d5cbe7..7c8fbb214 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/S3Host.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/S3Host.java @@ -160,26 +160,26 @@ public class S3Host implements ResourcePackHost { boolean useEnv = (boolean) arguments.getOrDefault("use-environment-variables", false); String endpoint = (String) arguments.get("endpoint"); if (endpoint == null || endpoint.isEmpty()) { - throw new LocalizedException("warning.config.host.s3.lack_endpoint"); + throw new LocalizedException("warning.config.host.s3.missing_endpoint"); } String protocol = (String) arguments.getOrDefault("protocol", "https"); boolean usePathStyle = (boolean) arguments.getOrDefault("path-style", false); String bucket = (String) arguments.get("bucket"); if (bucket == null || bucket.isEmpty()) { - throw new LocalizedException("warning.config.host.s3.lack_bucket"); + throw new LocalizedException("warning.config.host.s3.missing_bucket"); } String region = (String) arguments.getOrDefault("region", "auto"); String accessKeyId = useEnv ? System.getenv("CE_S3_ACCESS_KEY_ID") : (String) arguments.get("access-key-id"); if (accessKeyId == null || accessKeyId.isEmpty()) { - throw new LocalizedException("warning.config.host.s3.lack_access_key_id"); + throw new LocalizedException("warning.config.host.s3.missing_access_key"); } String accessKeySecret = useEnv ? System.getenv("CE_S3_ACCESS_KEY_SECRET") : (String) arguments.get("access-key-secret"); if (accessKeySecret == null || accessKeySecret.isEmpty()) { - throw new LocalizedException("warning.config.host.s3.lack_access_key_secret"); + throw new LocalizedException("warning.config.host.s3.missing_secret"); } String uploadPath = (String) arguments.getOrDefault("upload-path", "craftengine/resource_pack.zip"); if (uploadPath == null || uploadPath.isEmpty()) { - throw new LocalizedException("warning.config.host.s3.lack_upload_path"); + throw new LocalizedException("warning.config.host.s3.missing_upload_path"); } boolean useLegacySignature = (boolean) arguments.getOrDefault("use-legacy-signature", true); Duration validity = Duration.ofSeconds((int) arguments.getOrDefault("validity", 10)); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/SelfHost.java b/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/SelfHost.java index 88dde11e9..dea487a5a 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/SelfHost.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/host/impl/SelfHost.java @@ -63,7 +63,7 @@ public class SelfHost implements ResourcePackHost { SelfHostHttpServer selfHostHttpServer = SelfHostHttpServer.instance(); String ip = (String) arguments.get("ip"); if (ip == null) { - throw new LocalizedException("warning.config.host.self.lack_ip"); + throw new LocalizedException("warning.config.host.self.missing_ip"); } int port = ResourceConfigUtils.getAsInt(arguments.getOrDefault("port", 8163), "port"); if (port < 0 || port > 65535) { diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/BaseItemModel.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/BaseItemModel.java index 1a6deb312..564051d97 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/BaseItemModel.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/BaseItemModel.java @@ -71,11 +71,11 @@ public class BaseItemModel implements ItemModel { public ItemModel create(Map arguments) { Object path = arguments.get("path"); if (path == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.base.lack_path", new NullPointerException("'path' is required for 'minecraft:model'")); + throw new LocalizedResourceConfigException("warning.config.item.model.base.missing_path", new NullPointerException("'path' is required for 'minecraft:model'")); } String modelPath = path.toString(); if (!ResourceLocation.isValid(modelPath)) { - throw new LocalizedResourceConfigException("warning.config.item.model.base.invalid_resource_location", new IllegalArgumentException("Invalid resource location: " + modelPath), modelPath); + throw new LocalizedResourceConfigException("warning.config.item.model.base.invalid_path", new IllegalArgumentException("Invalid resource location: " + modelPath), modelPath); } Map generation = MiscUtils.castToMap(arguments.get("generation"), true); ModelGeneration modelGeneration = null; diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/CompositeItemModel.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/CompositeItemModel.java index 92d043472..01aaaac98 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/CompositeItemModel.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/CompositeItemModel.java @@ -58,7 +58,7 @@ public class CompositeItemModel implements ItemModel { if (m instanceof List list) { List> models = (List>) list; if (models.isEmpty()) { - throw new LocalizedResourceConfigException("warning.config.item.model.composite.lack_models", new IllegalArgumentException("'models' list should not be empty for 'minecraft:composite'")); + throw new LocalizedResourceConfigException("warning.config.item.model.composite.missing_models", new IllegalArgumentException("'models' list should not be empty for 'minecraft:composite'")); } List modelList = new ArrayList<>(); for (Map model : models) { @@ -68,7 +68,7 @@ public class CompositeItemModel implements ItemModel { } else if (m instanceof Map map) { return new CompositeItemModel(List.of(ItemModels.fromMap(MiscUtils.castToMap(map, false)))); } else { - throw new LocalizedResourceConfigException("warning.config.item.model.composite.lack_models", new NullPointerException("'models' argument is required for 'minecraft:composite'")); + throw new LocalizedResourceConfigException("warning.config.item.model.composite.missing_models", new NullPointerException("'models' argument is required for 'minecraft:composite'")); } } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/ConditionItemModel.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/ConditionItemModel.java index f1ebff144..78687b662 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/ConditionItemModel.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/ConditionItemModel.java @@ -68,13 +68,13 @@ public class ConditionItemModel implements ItemModel { if (arguments.get("on-true") instanceof Map map1) { onTrue = ItemModels.fromMap(MiscUtils.castToMap(map1, false)); } else { - throw new LocalizedResourceConfigException("warning.config.item.model.condition.lack_on_true", new NullPointerException("'on-true' is required for condition")); + throw new LocalizedResourceConfigException("warning.config.item.model.condition.missing_on_true", new NullPointerException("'on-true' is required for condition")); } ItemModel onFalse; if (arguments.get("on-false") instanceof Map map2) { onFalse = ItemModels.fromMap(MiscUtils.castToMap(map2, false)); } else { - throw new LocalizedResourceConfigException("warning.config.item.model.condition.lack_on_false", new NullPointerException("'on-false' is required for condition")); + throw new LocalizedResourceConfigException("warning.config.item.model.condition.missing_on_false", new NullPointerException("'on-false' is required for condition")); } return new ConditionItemModel(property, onTrue, onFalse); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/RangeDispatchItemModel.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/RangeDispatchItemModel.java index ab1f2167c..c54eb597c 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/RangeDispatchItemModel.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/RangeDispatchItemModel.java @@ -109,16 +109,16 @@ public class RangeDispatchItemModel implements ItemModel { float threshold = ResourceConfigUtils.getAsFloat(entry.getOrDefault("threshold", 1), "threshold"); Object model = entry.getOrDefault("model", fallback); if (model == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.entry.lack_model", new NullPointerException("'model' is required for range_dispatch entry")); + throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.entry.missing_model", new NullPointerException("'model' is required for range_dispatch entry")); } entryMap.put(threshold, ItemModels.fromMap(MiscUtils.castToMap(model, false))); } return new RangeDispatchItemModel(property, scale, fallback == null ? null : ItemModels.fromMap(fallback), entryMap); } else { - throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.lack_entries", new IllegalArgumentException("No entries found for range_dispatch")); + throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.missing_entries", new IllegalArgumentException("No entries found for range_dispatch")); } } else { - throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.lack_entries", new NullPointerException("'entries' is required for the range_dispatch model")); + throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.missing_entries", new NullPointerException("'entries' is required for the range_dispatch model")); } } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/SelectItemModel.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/SelectItemModel.java index e303dd635..d628d71e2 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/SelectItemModel.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/SelectItemModel.java @@ -106,7 +106,7 @@ public class SelectItemModel implements ItemModel { for (Map c : cases) { Object when = c.get("when"); if (when == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.select.case.lack_when", new NullPointerException("'when' should not be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.select.case.missing_when", new NullPointerException("'when' should not be null")); } Either> either; if (when instanceof List whenList) { @@ -120,16 +120,16 @@ public class SelectItemModel implements ItemModel { } Object model = c.get("model"); if (model == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.select.case.lack_model", new NullPointerException("'model' should not be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.select.case.missing_model", new NullPointerException("'model' should not be null")); } whenMap.put(either, ItemModels.fromMap(MiscUtils.castToMap(model, false))); } return new SelectItemModel(property, whenMap, fallback == null ? null : ItemModels.fromMap(fallback)); } else { - throw new LocalizedResourceConfigException("warning.config.item.model.select.lack_cases", new NullPointerException("'cases' is required for the select model")); + throw new LocalizedResourceConfigException("warning.config.item.model.select.missing_cases", new NullPointerException("'cases' is required for the select model")); } } else { - throw new LocalizedResourceConfigException("warning.config.item.model.select.lack_cases", new NullPointerException("'cases' is required for the select model")); + throw new LocalizedResourceConfigException("warning.config.item.model.select.missing_cases", new NullPointerException("'cases' is required for the select model")); } } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/ConditionProperties.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/ConditionProperties.java index 8c5ab2fae..f6033df00 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/ConditionProperties.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/ConditionProperties.java @@ -48,7 +48,7 @@ public class ConditionProperties { public static ConditionProperty fromMap(Map map) { String type = (String) map.get("property"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.condition.lack_property", new NullPointerException("property type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.condition.missing_property", new NullPointerException("property type cannot be null")); } Key key = Key.withDefaultNamespace(type, "minecraft"); ConditionPropertyFactory factory = BuiltInRegistries.CONDITION_PROPERTY_FACTORY.getValue(key); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/HasComponentConditionProperty.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/HasComponentConditionProperty.java index 3842ecf57..439be322b 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/HasComponentConditionProperty.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/HasComponentConditionProperty.java @@ -38,7 +38,7 @@ public class HasComponentConditionProperty implements ConditionProperty { boolean ignoreDefault = (boolean) arguments.getOrDefault("ignore-default", false); Object componentObj = arguments.get("component"); if (componentObj == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.condition.has_component.lack_component", new NullPointerException("component should not be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.condition.has_component.missing_component", new NullPointerException("component should not be null")); } String component = componentObj.toString(); return new HasComponentConditionProperty(component, ignoreDefault); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/KeyBindDownConditionProperty.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/KeyBindDownConditionProperty.java index 9482c4b5f..8599fbe5e 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/KeyBindDownConditionProperty.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/KeyBindDownConditionProperty.java @@ -32,7 +32,7 @@ public class KeyBindDownConditionProperty implements ConditionProperty { public ConditionProperty create(Map arguments) { Object keybindObj = arguments.get("keybind"); if (keybindObj == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.condition.keybind_down.lack_keybind", new NullPointerException("keybind should not be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.condition.keybind.missing", new NullPointerException("keybind should not be null")); } String keybind = keybindObj.toString(); return new KeyBindDownConditionProperty(keybind); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/generation/AbstractModelGenerator.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/generation/AbstractModelGenerator.java index 90ce13fca..e34e9f374 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/generation/AbstractModelGenerator.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/generation/AbstractModelGenerator.java @@ -2,10 +2,9 @@ package net.momirealms.craftengine.core.pack.model.generation; import net.momirealms.craftengine.core.pack.ResourceLocation; import net.momirealms.craftengine.core.plugin.CraftEngine; -import net.momirealms.craftengine.core.plugin.locale.TranslationManager; +import net.momirealms.craftengine.core.plugin.locale.LocalizedResourceConfigException; import net.momirealms.craftengine.core.util.Key; -import java.nio.file.Path; import java.util.Collection; import java.util.HashMap; import java.util.Map; @@ -28,21 +27,20 @@ public abstract class AbstractModelGenerator implements ModelGenerator { this.modelsToGenerate.clear(); } - public void prepareModelGeneration(Path path, Key id, ModelGeneration model) { + public void prepareModelGeneration(ModelGeneration model) { ModelGeneration conflict = this.modelsToGenerate.get(model.path()); if (conflict != null) { if (conflict.equals(model)) { return; } - TranslationManager.instance().log("warning.config.model.generation.conflict", path.toString(), id.toString(), model.path().toString()); - return; + throw new LocalizedResourceConfigException("warning.config.model.generation.conflict", model.path().toString()); } if (!ResourceLocation.isValid(model.parentModelPath())) { - TranslationManager.instance().log("warning.config.model.generation.parent.invalid_resource_location", path.toString(), id.toString(), model.parentModelPath()); + throw new LocalizedResourceConfigException("warning.config.model.generation.parent.invalid", model.parentModelPath()); } for (Map.Entry texture : model.texturesOverride().entrySet()) { if (!ResourceLocation.isValid(texture.getValue())) { - TranslationManager.instance().log("warning.config.model.generation.texture.invalid_resource_location", path.toString(), id.toString(), texture.getKey(), texture.getValue()); + throw new LocalizedResourceConfigException("warning.config.model.generation.texture.invalid", texture.getKey(), texture.getValue()); } } this.modelsToGenerate.put(model.path(), model); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/generation/ModelGeneration.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/generation/ModelGeneration.java index 2c00d885c..e95462336 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/generation/ModelGeneration.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/generation/ModelGeneration.java @@ -25,7 +25,7 @@ public class ModelGeneration { this.path = path; Object parent = map.get("parent"); if (parent == null) { - throw new LocalizedResourceConfigException("warning.config.model.generation.lack_parent", new NullPointerException("'parent' argument is required for generation")); + throw new LocalizedResourceConfigException("warning.config.model.generation.missing_parent", new NullPointerException("'parent' argument is required for generation")); } this.parentModelPath = parent.toString(); Map texturesMap = MiscUtils.castToMap(map.get("textures"), true); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/CompassRangeDispatchProperty.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/CompassRangeDispatchProperty.java index 1a3d0c2a2..d55586a7c 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/CompassRangeDispatchProperty.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/CompassRangeDispatchProperty.java @@ -32,7 +32,7 @@ public class CompassRangeDispatchProperty implements RangeDispatchProperty { public RangeDispatchProperty create(Map arguments) { Object targetObj = arguments.get("target"); if (targetObj == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.compass.lack_target", new NullPointerException("target should not be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.compass.missing_target", new NullPointerException("target should not be null")); } String target = targetObj.toString(); return new CompassRangeDispatchProperty(target); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/RangeDispatchProperties.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/RangeDispatchProperties.java index 6c9f57fcd..3e8021d8b 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/RangeDispatchProperties.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/RangeDispatchProperties.java @@ -44,7 +44,7 @@ public class RangeDispatchProperties { public static RangeDispatchProperty fromMap(Map map) { String type = (String) map.get("property"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.lack_property", new NullPointerException("property type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.missing_property", new NullPointerException("property type cannot be null")); } Key key = Key.withDefaultNamespace(type, "minecraft"); RangeDispatchPropertyFactory factory = BuiltInRegistries.RANGE_DISPATCH_PROPERTY_FACTORY.getValue(key); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/TimeRangeDispatchProperty.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/TimeRangeDispatchProperty.java index df8f38d99..bc4ea4c22 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/TimeRangeDispatchProperty.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/TimeRangeDispatchProperty.java @@ -37,7 +37,7 @@ public class TimeRangeDispatchProperty implements RangeDispatchProperty { public RangeDispatchProperty create(Map arguments) { Object sourceObj = arguments.get("source"); if (sourceObj == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.time.lack_source", new NullPointerException("source should not be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.time.missing_source", new NullPointerException("source should not be null")); } String source = sourceObj.toString(); boolean wobble = (boolean) arguments.getOrDefault("wobble", true); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/select/BlockStateSelectProperty.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/select/BlockStateSelectProperty.java index e4e187e2b..127d6ae4d 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/select/BlockStateSelectProperty.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/select/BlockStateSelectProperty.java @@ -32,7 +32,7 @@ public class BlockStateSelectProperty implements SelectProperty { public SelectProperty create(Map arguments) { Object property = arguments.get("block-state-property"); if (property == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.select.block_state.lack_block_state_property", new NullPointerException("block-state-property should not be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.select.block_state.missing_property", new NullPointerException("block-state-property should not be null")); } String blockStateProperty = property.toString(); return new BlockStateSelectProperty(blockStateProperty); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/select/LocalTimeSelectProperty.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/select/LocalTimeSelectProperty.java index d557d882c..84e97c1c8 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/select/LocalTimeSelectProperty.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/select/LocalTimeSelectProperty.java @@ -45,7 +45,7 @@ public class LocalTimeSelectProperty implements SelectProperty { public SelectProperty create(Map arguments) { Object patternObj = arguments.get("pattern"); if (patternObj == null) { - throw new IllegalArgumentException("warning.config.item.model.select.local_time.lack_pattern", new NullPointerException("pattern should not be null")); + throw new IllegalArgumentException("warning.config.item.model.select.local_time.missing_pattern", new NullPointerException("pattern should not be null")); } String pattern = patternObj.toString(); String locale = (String) arguments.get("locale"); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/select/SelectProperties.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/select/SelectProperties.java index 1c9b62a17..55f145e97 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/select/SelectProperties.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/select/SelectProperties.java @@ -42,7 +42,7 @@ public class SelectProperties { public static SelectProperty fromMap(Map map) { String type = (String) map.get("property"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.select.lack_property", new NullPointerException("property type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.select.missing_property", new NullPointerException("property type cannot be null")); } Key key = Key.withDefaultNamespace(type, "minecraft"); SelectPropertyFactory factory = BuiltInRegistries.SELECT_PROPERTY_FACTORY.getValue(key); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/special/SpecialModels.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/special/SpecialModels.java index 6fa7d9efd..ceb361452 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/special/SpecialModels.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/special/SpecialModels.java @@ -45,7 +45,7 @@ public class SpecialModels { public static SpecialModel fromMap(Map map) { String type = (String) map.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.special.lack_type", new NullPointerException("special model type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.special.missing_type", new NullPointerException("special model type cannot be null")); } Key key = Key.withDefaultNamespace(type, "minecraft"); SpecialModelFactory factory = BuiltInRegistries.SPECIAL_MODEL_FACTORY.getValue(key); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/ConstantTint.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/ConstantTint.java index 469ce3655..6b4978557 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/ConstantTint.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/ConstantTint.java @@ -35,7 +35,7 @@ public class ConstantTint implements Tint { public Tint create(Map arguments) { Object value = arguments.get("value"); if (value == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.tint.constant.lack_value", new NullPointerException("value should not be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.tint.constant.missing_value", new NullPointerException("value should not be null")); } return new ConstantTint(parseTintValue(value)); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/GrassTint.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/GrassTint.java index 06de9de31..17c2e6163 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/GrassTint.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/GrassTint.java @@ -39,7 +39,7 @@ public class GrassTint implements Tint { float temperature = ResourceConfigUtils.getAsFloat(arguments.getOrDefault("temperature", 0), "temperature"); float downfall = ResourceConfigUtils.getAsFloat(arguments.getOrDefault("downfall", 0), "downfall"); if (temperature > 1 || temperature < 0) { - throw new LocalizedResourceConfigException("warning.config.item.model.tint.grass.invalid_temperature", new IllegalArgumentException("Invalid temperature: " + temperature + ". Valid range 0~1"), String.valueOf(temperature)); + throw new LocalizedResourceConfigException("warning.config.item.model.tint.grass.invalid_temp", new IllegalArgumentException("Invalid temperature: " + temperature + ". Valid range 0~1"), String.valueOf(temperature)); } if (downfall > 1 || downfall < 0) { throw new LocalizedResourceConfigException("warning.config.item.model.tint.grass.invalid_downfall", new IllegalArgumentException("Invalid downfall: " + downfall + ". Valid range 0~1"), String.valueOf(downfall)); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/Tints.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/Tints.java index 2aa65e8e3..d6e701427 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/Tints.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/Tints.java @@ -40,7 +40,7 @@ public class Tints { public static Tint fromMap(Map map) { String type = (String) map.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.tint.lack_type", new NullPointerException("'type' cannot be null for tint")); + throw new LocalizedResourceConfigException("warning.config.item.model.tint.missing_type", new NullPointerException("'type' cannot be null for tint")); } Key key = Key.withDefaultNamespace(type, "minecraft"); TintFactory factory = BuiltInRegistries.TINT_FACTORY.getValue(key); diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/config/template/SelfIncreaseIntTemplateArgument.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/config/template/SelfIncreaseIntTemplateArgument.java index 49dda102a..daf5e89e1 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/config/template/SelfIncreaseIntTemplateArgument.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/config/template/SelfIncreaseIntTemplateArgument.java @@ -49,7 +49,7 @@ public class SelfIncreaseIntTemplateArgument implements TemplateArgument { public TemplateArgument create(Map arguments) { int from = ResourceConfigUtils.getAsInt(arguments.get("from"), "from"); int to = ResourceConfigUtils.getAsInt(arguments.get("to"), "to"); - if (from > to) throw new LocalizedResourceConfigException("warning.config.template.from_larger_than_to", String.valueOf(from), String.valueOf(to)); + if (from > to) throw new LocalizedResourceConfigException("warning.config.template.argument.self_increase_int.invalid_range", String.valueOf(from), String.valueOf(to)); return new SelfIncreaseIntTemplateArgument(from, to); } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/config/template/TemplateManagerImpl.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/config/template/TemplateManagerImpl.java index 5af708de5..7ae3a8aac 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/config/template/TemplateManagerImpl.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/config/template/TemplateManagerImpl.java @@ -63,7 +63,7 @@ public class TemplateManagerImpl implements TemplateManager { @Override public void addTemplate(Pack pack, Path path, Key id, Object obj) { if (this.templates.containsKey(id)) { - throw new LocalizedResourceConfigException("warning.config.template.duplicated", path.toString(), id.toString()); + throw new LocalizedResourceConfigException("warning.config.template.duplicate", path.toString(), id.toString()); } this.templates.put(id, obj); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/sound/AbstractSoundManager.java b/core/src/main/java/net/momirealms/craftengine/core/sound/AbstractSoundManager.java index d1ace9653..ff6878e77 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/sound/AbstractSoundManager.java +++ b/core/src/main/java/net/momirealms/craftengine/core/sound/AbstractSoundManager.java @@ -75,16 +75,16 @@ public abstract class AbstractSoundManager implements SoundManager { @Override public void parseSection(Pack pack, Path path, Key id, Map section) { if (AbstractSoundManager.this.songs.containsKey(id)) { - throw new LocalizedResourceConfigException("warning.config.jukebox_song.duplicated", path, id); + throw new LocalizedResourceConfigException("warning.config.jukebox_song.duplicate", path, id); } - String sound = (String) section.get("sound"); + Object sound = section.get("sound"); if (sound == null) { - throw new LocalizedResourceConfigException("warning.config.jukebox_song.lack_sound", path, id); + throw new LocalizedResourceConfigException("warning.config.jukebox_song.missing_sound", path, id); } Component description = AdventureHelper.miniMessage().deserialize(section.getOrDefault("description", "").toString()); float length = ResourceConfigUtils.getAsFloat(section.get("length"), "length"); int comparatorOutput = ResourceConfigUtils.getAsInt(section.getOrDefault("comparator-output", 15), "comparator-output"); - JukeboxSong song = new JukeboxSong(Key.of(sound), description, length, comparatorOutput, ResourceConfigUtils.getAsFloat(section.getOrDefault("range", 32f), "range")); + JukeboxSong song = new JukeboxSong(Key.of(sound.toString()), description, length, comparatorOutput, ResourceConfigUtils.getAsFloat(section.getOrDefault("range", 32f), "range")); AbstractSoundManager.this.songs.put(id, song); } } @@ -105,13 +105,13 @@ public abstract class AbstractSoundManager implements SoundManager { @Override public void parseSection(Pack pack, Path path, Key id, Map section) { if (AbstractSoundManager.this.byId.containsKey(id)) { - throw new LocalizedResourceConfigException("warning.config.sound.duplicated", path, id); + throw new LocalizedResourceConfigException("warning.config.sound.duplicate", path, id); } boolean replace = (boolean) section.getOrDefault("replace", false); String subtitle = (String) section.get("subtitle"); List soundList = (List) section.get("sounds"); if (soundList == null) { - throw new LocalizedResourceConfigException("warning.config.sound.lack_sounds", path, id); + throw new LocalizedResourceConfigException("warning.config.sound.missing_sounds", path, id); } List sounds = new ArrayList<>(); for (Object sound : soundList) { diff --git a/core/src/main/java/net/momirealms/craftengine/core/sound/Sound.java b/core/src/main/java/net/momirealms/craftengine/core/sound/Sound.java index 71e16f911..f7a0d723e 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/sound/Sound.java +++ b/core/src/main/java/net/momirealms/craftengine/core/sound/Sound.java @@ -53,7 +53,7 @@ public interface Sound extends Supplier { public static SoundFile fromMap(Map map) { Object name = map.get("name"); - if (name == null) throw new LocalizedResourceConfigException("warning.config.sound.lack_name", new NullPointerException("Missing required property 'name'")); + if (name == null) throw new LocalizedResourceConfigException("warning.config.sound.missing_name", new NullPointerException("Missing required property 'name'")); Builder builder = file(name.toString()); for (Map.Entry entry : map.entrySet()) { Optional.ofNullable(Builder.MODIFIERS.get(entry.getKey())).ifPresent(modifier -> modifier.apply(builder, entry.getValue())); diff --git a/core/src/main/java/net/momirealms/craftengine/core/util/CharacterUtils.java b/core/src/main/java/net/momirealms/craftengine/core/util/CharacterUtils.java index 6a07d4f57..2d8693728 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/util/CharacterUtils.java +++ b/core/src/main/java/net/momirealms/craftengine/core/util/CharacterUtils.java @@ -23,7 +23,7 @@ public class CharacterUtils { chars[i] = (char) codePoint; } } catch (NumberFormatException e) { - throw new LocalizedResourceConfigException("warning.config.image.invalid_hex", e, hex); + throw new LocalizedResourceConfigException("warning.config.image.invalid_hex_value", e, hex); } } return chars; diff --git a/core/src/main/java/net/momirealms/craftengine/core/util/MiscUtils.java b/core/src/main/java/net/momirealms/craftengine/core/util/MiscUtils.java index 463218307..659cab125 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/util/MiscUtils.java +++ b/core/src/main/java/net/momirealms/craftengine/core/util/MiscUtils.java @@ -59,7 +59,7 @@ public class MiscUtils { } else if (split.length == 1) { return new Vector3f(Float.parseFloat(split[0])); } else { - throw new LocalizedResourceConfigException("warning.config.cast_vector3f", new RuntimeException("Cannot convert " + o + " to Vector3f"), stringFormat, option); + throw new LocalizedResourceConfigException("warning.config.type.vector3f", new RuntimeException("Cannot convert " + o + " to Vector3f"), stringFormat, option); } } @@ -72,7 +72,7 @@ public class MiscUtils { } else if (split.length == 1) { return QuaternionUtils.toQuaternionf(0, Math.toRadians(Float.parseFloat(split[0])), 0); } else { - throw new LocalizedResourceConfigException("warning.config.cast_quaternionf", new RuntimeException("Cannot convert " + o + " to Quaternionf"), stringFormat, option); + throw new LocalizedResourceConfigException("warning.config.type.quaternionf", new RuntimeException("Cannot convert " + o + " to Quaternionf"), stringFormat, option); } } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/util/ResourceConfigUtils.java b/core/src/main/java/net/momirealms/craftengine/core/util/ResourceConfigUtils.java index 0ad2edc63..172c9da89 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/util/ResourceConfigUtils.java +++ b/core/src/main/java/net/momirealms/craftengine/core/util/ResourceConfigUtils.java @@ -23,13 +23,13 @@ public final class ResourceConfigUtils { try { return Integer.parseInt(s); } catch (NumberFormatException e) { - throw new LocalizedResourceConfigException("warning.config.cast_int", e, s, option); + throw new LocalizedResourceConfigException("warning.config.type.int", e, s, option); } } case Boolean b -> { return b ? 1 : 0; } - default -> throw new LocalizedResourceConfigException("warning.config.cast_int", o.toString(), option); + default -> throw new LocalizedResourceConfigException("warning.config.type.int", o.toString(), option); } } @@ -48,11 +48,11 @@ public final class ResourceConfigUtils { try { return Double.parseDouble(s); } catch (NumberFormatException e) { - throw new LocalizedResourceConfigException("warning.config.cast_double", e, s, option); + throw new LocalizedResourceConfigException("warning.config.type.double", e, s, option); } } default -> { - throw new LocalizedResourceConfigException("warning.config.cast_double", o.toString(), option); + throw new LocalizedResourceConfigException("warning.config.type.double", o.toString(), option); } } } @@ -69,14 +69,14 @@ public final class ResourceConfigUtils { try { return Float.parseFloat(s); } catch (NumberFormatException e) { - throw new LocalizedResourceConfigException("warning.config.cast_float", e, s, option); + throw new LocalizedResourceConfigException("warning.config.type.float", e, s, option); } } case Number number -> { return number.floatValue(); } default -> { - throw new LocalizedResourceConfigException("warning.config.cast_float", o.toString(), option); + throw new LocalizedResourceConfigException("warning.config.type.float", o.toString(), option); } } }