From cdad8190f10b3ae5b5a5b6348ed7744cbf88dc8f Mon Sep 17 00:00:00 2001 From: halogly Date: Sat, 23 Aug 2025 11:27:07 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E6=94=B9=E8=BF=9B=E5=91=BD=E4=BB=A4=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../item/listener/ItemEventListener.java | 6 ++- .../plugin/user/BukkitServerPlayer.java | 36 ++++++++++--- .../craftengine/bukkit/util/SoundUtils.java | 1 + .../bukkit/world/BukkitBlockInWorld.java | 7 +++ .../src/main/resources/translations/de.yml | 2 + .../src/main/resources/translations/en.yml | 12 +++-- .../src/main/resources/translations/ru_ru.yml | 2 + .../src/main/resources/translations/zh_cn.yml | 8 ++- .../core/entity/player/Player.java | 12 ++++- .../context/condition/CommonConditions.java | 18 +++++++ .../condition/MatchBlockTypeCondition.java | 50 +++++++++++++++++++ .../condition/MatchEntityTypeCondition.java | 48 ++++++++++++++++++ .../context/condition/MatchItemCondition.java | 12 +---- .../plugin/context/event/EventConditions.java | 2 + .../context/function/CommandFunction.java | 31 +++++++----- .../parameter/DirectContextParameters.java | 5 +- .../parameter/PlayerParameterProvider.java | 5 +- .../craftengine/core/sound/SoundSource.java | 3 +- .../craftengine/core/world/BlockInWorld.java | 3 ++ 19 files changed, 221 insertions(+), 42 deletions(-) create mode 100644 core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchBlockTypeCondition.java create mode 100644 core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchEntityTypeCondition.java diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/listener/ItemEventListener.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/listener/ItemEventListener.java index db9aff35a..e5906ab91 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/listener/ItemEventListener.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/listener/ItemEventListener.java @@ -3,6 +3,7 @@ package net.momirealms.craftengine.bukkit.item.listener; import io.papermc.paper.event.block.CompostItemEvent; import net.momirealms.craftengine.bukkit.api.BukkitAdaptors; import net.momirealms.craftengine.bukkit.api.event.CustomBlockInteractEvent; +import net.momirealms.craftengine.bukkit.entity.BukkitEntity; import net.momirealms.craftengine.bukkit.item.BukkitCustomItem; import net.momirealms.craftengine.bukkit.item.BukkitItemManager; import net.momirealms.craftengine.bukkit.nms.FastNMS; @@ -96,9 +97,10 @@ public class ItemEventListener implements Listener { Cancellable cancellable = Cancellable.of(event::isCancelled, event::setCancelled); PlayerOptionalContext context = PlayerOptionalContext.of(serverPlayer, ContextHolder.builder() .withOptionalParameter(DirectContextParameters.ITEM_IN_HAND, itemInHand) - .withParameter(DirectContextParameters.EVENT, cancellable) - .withParameter(DirectContextParameters.POSITION, LocationUtils.toWorldPosition(event.getRightClicked().getLocation())) .withParameter(DirectContextParameters.HAND, hand) + .withParameter(DirectContextParameters.EVENT, cancellable) + .withParameter(DirectContextParameters.ENTITY, new BukkitEntity(entity)) + .withParameter(DirectContextParameters.POSITION, LocationUtils.toWorldPosition(event.getRightClicked().getLocation())) ); CustomItem customItem = optionalCustomItem.get(); customItem.execute(context, EventTrigger.RIGHT_CLICK); diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/user/BukkitServerPlayer.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/user/BukkitServerPlayer.java index bf6afab4b..51f382f78 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/user/BukkitServerPlayer.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/user/BukkitServerPlayer.java @@ -40,6 +40,7 @@ import org.bukkit.*; import org.bukkit.attribute.Attribute; import org.bukkit.attribute.AttributeInstance; import org.bukkit.block.Block; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; @@ -177,6 +178,26 @@ public class BukkitServerPlayer extends Player { return platformPlayer().isSneaking(); } + @Override + public boolean isSwimming() { + return platformPlayer().isSwimming(); + } + + @Override + public boolean isClimbing() { + return platformPlayer().isClimbing(); + } + + @Override + public boolean isGliding() { + return platformPlayer().isGliding(); + } + + @Override + public boolean isFlying() { + return platformPlayer().isFlying(); + } + @Override public GameMode gameMode() { return switch (platformPlayer().getGameMode()) { @@ -475,7 +496,7 @@ public class BukkitServerPlayer extends Player { ImmutableBlockState customState = optionalCustomState.get(); Item tool = getItemInHand(InteractionHand.MAIN_HAND); boolean isCorrectTool = FastNMS.INSTANCE.method$ItemStack$isCorrectToolForDrops(tool.getLiteralObject(), blockState); - // 如果自定义方块在服务端侧未使用正确地工具,那么需要还原挖掘速度 + // 如果自定义方块在服务端侧未使用正确的工具,那么需要还原挖掘速度 if (!isCorrectTool) { progress *= (10f / 3f); } @@ -939,6 +960,14 @@ public class BukkitServerPlayer extends Player { platformPlayer().performCommand(command); } + @Override + @SuppressWarnings("UnstableApiUsage") + public void performCommandAsEvent(String command) { + String formattedCommand = command.startsWith("/") ? command : "/" + command; + PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(platformPlayer(), formattedCommand); + Bukkit.getPluginManager().callEvent(event); + } + @Override public double luck() { if (VersionHelper.isOrAbove1_21_3()) { @@ -948,11 +977,6 @@ public class BukkitServerPlayer extends Player { } } - @Override - public boolean isFlying() { - return platformPlayer().isFlying(); - } - @Override public int foodLevel() { return platformPlayer().getFoodLevel(); diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/util/SoundUtils.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/util/SoundUtils.java index 9f21529df..64ff47e55 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/util/SoundUtils.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/util/SoundUtils.java @@ -37,6 +37,7 @@ public final class SoundUtils { case HOSTILE -> SoundCategory.HOSTILE; case NEUTRAL -> SoundCategory.NEUTRAL; case WEATHER -> SoundCategory.WEATHER; + case UI -> SoundCategory.UI; }; } } diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/world/BukkitBlockInWorld.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/world/BukkitBlockInWorld.java index 6a9ce89a4..2be28902a 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/world/BukkitBlockInWorld.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/world/BukkitBlockInWorld.java @@ -6,10 +6,12 @@ import net.momirealms.craftengine.bukkit.plugin.reflection.minecraft.CoreReflect import net.momirealms.craftengine.bukkit.plugin.reflection.minecraft.MBlocks; import net.momirealms.craftengine.bukkit.plugin.reflection.minecraft.MFluids; import net.momirealms.craftengine.bukkit.util.BlockStateUtils; +import net.momirealms.craftengine.bukkit.util.KeyUtils; import net.momirealms.craftengine.bukkit.util.LocationUtils; import net.momirealms.craftengine.core.block.CustomBlock; import net.momirealms.craftengine.core.block.ImmutableBlockState; import net.momirealms.craftengine.core.item.context.BlockPlaceContext; +import net.momirealms.craftengine.core.util.Key; import net.momirealms.craftengine.core.world.BlockInWorld; import net.momirealms.craftengine.core.world.World; import org.bukkit.Location; @@ -59,6 +61,11 @@ public class BukkitBlockInWorld implements BlockInWorld { return this.block.getZ(); } + @Override + public Key type() { + return KeyUtils.namespacedKey2Key(this.block.getType().getKey()); + } + @Override public World world() { return new BukkitWorld(this.block.getWorld()); diff --git a/common-files/src/main/resources/translations/de.yml b/common-files/src/main/resources/translations/de.yml index 3e3ffe8b1..99b377def 100644 --- a/common-files/src/main/resources/translations/de.yml +++ b/common-files/src/main/resources/translations/de.yml @@ -106,6 +106,8 @@ warning.config.condition.expression.missing_expression: "Problem in Date warning.config.condition.is_null.missing_argument: "Problem in Datei gefunden - Bei der Config '' fehlt das erforderliche 'argument'-Argument für die 'is_null'-Bedingung." warning.config.condition.hand.missing_hand: "Problem in Datei gefunden - Bei der Config '' fehlt das erforderliche 'hand'-Argument für die 'hand'-Bedingung." warning.config.condition.hand.invalid_hand: "Problem in Datei gefunden - Die Config '' verwendet ein ungültiges 'hand'-Argument '' für die 'hand'-Bedingung. Erlaubte Hand-Typen: []" +warning.config.condition.gamemode.missing_gamemode: "Problem in Datei gefunden - Der Konfiguration '' fehlt das erforderliche 'gamemode'-Argument für die 'gamemode'-Bedingung." +warning.config.condition.gamemode.invalid_gamemode: "Problem in Datei gefunden - Die Konfiguration '' verwendet ein ungültiges 'gamemode'-Argument '' für die 'gamemode'-Bedingung. Erlaubte Handtypen: []" warning.config.condition.on_cooldown.missing_id: "Problem in Datei gefunden - Bei der Config '' fehlt das erforderliche 'id'-Argument für die 'on_cooldown'-Bedingung." warning.config.structure.not_section: "Problem in Datei gefunden - Die Config '' wird als Config-Abschnitt erwartet, ist aber tatsächlich ein(e) ''." warning.config.image.duplicate: "Problem in Datei gefunden - Doppeltes Image ''. Bitte prüfe, ob dieselbe Konfiguration in anderen Dateien vorhanden ist." diff --git a/common-files/src/main/resources/translations/en.yml b/common-files/src/main/resources/translations/en.yml index c15db1c61..3a73bd5d4 100644 --- a/common-files/src/main/resources/translations/en.yml +++ b/common-files/src/main/resources/translations/en.yml @@ -92,6 +92,8 @@ warning.config.condition.inverted.invalid_term_type: "Issue found in fil warning.config.condition.enchantment.missing_predicate: "Issue found in file - The config '' is missing the required 'predicate' argument for 'enchantment' condition." warning.config.condition.enchantment.invalid_predicate: "Issue found in file - The config '' is using an invalid enchantment 'predicate' argument ''." warning.config.condition.match_block_property.missing_properties: "Issue found in file - The config '' is missing the required 'properties' argument for 'match_block_property' condition." +warning.config.condition.match_block_type.missing_id: "Issue found in file - The config '' is missing the required 'id' argument for 'match_block_type' condition." +warning.config.condition.match_entity_type.missing_id: "Issue found in file - The config '' is missing the required 'id' argument for 'match_entity_type' condition." warning.config.condition.match_item.missing_id: "Issue found in file - The config '' is missing the required 'id' argument for 'match_item' condition." warning.config.condition.table_bonus.missing_enchantment: "Issue found in file - The config '' is missing the required 'enchantment' argument for 'table_bonus' condition." warning.config.condition.table_bonus.missing_chances: "Issue found in file - The config '' is missing the required 'chances' argument for 'table_bonus' condition." @@ -106,6 +108,8 @@ warning.config.condition.expression.missing_expression: "Issue found in warning.config.condition.is_null.missing_argument: "Issue found in file - The config '' is missing the required 'argument' argument for 'is_null' condition." warning.config.condition.hand.missing_hand: "Issue found in file - The config '' is missing the required 'hand' argument for 'hand' condition." warning.config.condition.hand.invalid_hand: "Issue found in file - The config '' is using an invalid 'hand' argument '' for 'hand' condition. Allowed hand types: []" +warning.config.condition.gamemode.missing_gamemode: "Issue found in file - The config '' is missing the required 'gamemode' argument for 'gamemode' condition." +warning.config.condition.gamemode.invalid_gamemode: "Issue found in file - The config '' is using an invalid 'gamemode' argument '' for 'gamemode' condition. Allowed gamemode types: []" warning.config.condition.on_cooldown.missing_id: "Issue found in file - The config '' is missing the required 'id' argument for 'on_cooldown' condition." 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 ''. Please check if there is the same configuration in other files." @@ -295,7 +299,7 @@ warning.config.block.behavior.fence_gate.missing_facing: "Issue found in warning.config.block.behavior.fence_gate.missing_in_wall: "Issue found in file - The block '' is missing the required 'in_wall' argument for 'fence_gate_block' behavior." warning.config.block.behavior.fence_gate.missing_open: "Issue found in file - The block '' is missing the required 'powered' argument for 'fence_gate_block' behavior." warning.config.block.behavior.fence_gate.missing_powered: "Issue found in file - The block '' is missing the required 'open' argument for 'fence_gate_block' behavior." -warning.config.block.behavior.trapdoor.missing_type: "Issue found in file - The block '' is missing the required 'type' property for 'slab_block' behavior." +warning.config.block.behavior.slab.missing_type: "Issue found in file - The block '' is missing the required 'type' property for 'slab_block' behavior." warning.config.block.behavior.stairs.missing_facing: "Issue found in file - The block '' is missing the required 'facing' property for 'stairs_block' behavior." warning.config.block.behavior.stairs.missing_half: "Issue found in file - The block '' is missing the required 'half' property for 'stairs_block' behavior." warning.config.block.behavior.stairs.missing_shape: "Issue found in file - The block '' is missing the required 'shape' property for 'stairs_block' behavior." @@ -303,9 +307,9 @@ warning.config.block.behavior.pressure_plate.missing_powered: "Issue fou warning.config.block.behavior.grass.missing_feature: "Issue found in file - The block '' is missing the required 'feature' argument for 'grass_block' behavior." warning.config.block.behavior.double_high.missing_half: "Issue found in file - The block '' is missing the required 'half' property for 'double_block' behavior." warning.config.model.generation.missing_parent: "Issue found in file - The config '' is missing the required 'parent' argument in 'generation' section." +warning.config.model.generation.conflict: "Issue found in file - Failed to generate model for '' as two or more configurations attempt to generate different json models with the same path: ''." warning.config.model.generation.invalid_display_position: "Issue found in file - The config '' is using an invalid display position '' in 'generation.display' section. Allowed display positions: []" warning.config.model.generation.invalid_gui_light: "Issue found in file - The config '' is using an invalid gui-light option '' in 'generation' section. Allowed gui light options: []" -warning.config.model.generation.conflict: "Issue found in file - Failed to generate model for '' as two or more configurations attempt to generate different json models with the same path: ''." warning.config.model.generation.texture.invalid: "Issue found in file - The config '' has a texture '' with path '' that contains illegal characters. Please read https://minecraft.wiki/w/Resource_location#Legal_characters." warning.config.model.generation.parent.invalid: "Issue found in file - The config '' has a parent argument '' that contains illegal characters. Please read https://minecraft.wiki/w/Resource_location#Legal_characters." warning.config.emoji.missing_keywords: "Issue found in file - The emoji '' is missing the required 'keywords' argument." @@ -411,14 +415,14 @@ warning.config.selector.invalid_type: "Issue found in file - The warning.config.selector.invalid_target: "Issue found in file - The config '' is using an invalid selector target ''." warning.config.resource_pack.item_model.already_exist: "Failed to generate item model for '' because the file '' already exists." warning.config.resource_pack.model.generation.already_exist: "Failed to generate model because the model file '' already exists." +warning.config.resource_pack.generation.malformatted_json: "Json file '' is malformatted." warning.config.resource_pack.generation.missing_font_texture: "Font '' is missing required texture: ''" -warning.config.resource_pack.generation.texture_not_in_atlas: "Texture '' is not listed in the atlas. You need to add the texture path to the atlas or enable 'obfuscation' option in config.yml." warning.config.resource_pack.generation.missing_model_texture: "Model '' is missing texture ''" warning.config.resource_pack.generation.missing_item_model: "Item '' is missing model file: ''" warning.config.resource_pack.generation.missing_block_model: "Block state '' is missing model file: ''" warning.config.resource_pack.generation.missing_parent_model: "Model '' cannot find parent model: ''" -warning.config.resource_pack.generation.malformatted_json: "Json file '' is malformatted." warning.config.resource_pack.generation.missing_equipment_texture: "Equipment '' is missing texture ''" +warning.config.resource_pack.generation.texture_not_in_atlas: "Texture '' is not listed in the atlas. You need to add the texture path to the atlas or enable 'obfuscation' option in config.yml." warning.config.resource_pack.invalid_overlay_format: "Issue found in config.yml at 'resource-pack.overlay-format' - Invalid overlay format ''. Overlay format must contain the placeholder '{version}'." warning.config.equipment.duplicate: "Issue found in file - Duplicated equipment ''. Please check if there is the same configuration in other files." warning.config.equipment.missing_type: "Issue found in file - The equipment '' is missing the required 'type' argument." diff --git a/common-files/src/main/resources/translations/ru_ru.yml b/common-files/src/main/resources/translations/ru_ru.yml index 60036cb99..120af2f0e 100644 --- a/common-files/src/main/resources/translations/ru_ru.yml +++ b/common-files/src/main/resources/translations/ru_ru.yml @@ -104,6 +104,8 @@ warning.config.condition.expression.missing_expression: "Проблем warning.config.condition.is_null.missing_argument: "Проблема найдена в файле - В конфигурации '' отсутствует необходимый 'argument' аргумент для 'is_null' состояния." warning.config.condition.hand.missing_hand: "Проблема найдена в файле - В конфигурации '' отсутствует необходимый 'hand' аргумент для 'hand' состояния." warning.config.condition.hand.invalid_hand: "Проблема найдена в файле - В конфигурации '' использует недействительный 'hand' аргумент '' для 'hand' состояния. Допустимые типы рук: []" +warning.config.condition.gamemode.missing_gamemode: "Проблема найдена в файле - В конфигурации '' отсутствует необходимый 'gamemode' аргумент для 'gamemode' состояния." +warning.config.condition.gamemode.invalid_gamemode: "Проблема найдена в файле - В конфигурации '' использует недействительный 'gamemode' аргумент '' для 'gamemode' состояния. Допустимые типы режимов игры: []" warning.config.condition.on_cooldown.missing_id: "Проблема найдена в файле - В конфигурации '' отсутствует необходимый 'id' аргумент для 'on_cooldown' состояния." warning.config.structure.not_section: "Проблема найдена в файле - В конфигурации '' ожидается, что это будет раздел конфигурации, хотя на самом деле это a(n) ''." warning.config.image.duplicate: "Проблема найдена в файле - Дублированное изображение ''. Проверьте, есть ли такая же конфигурация в других файлах." diff --git a/common-files/src/main/resources/translations/zh_cn.yml b/common-files/src/main/resources/translations/zh_cn.yml index 348ab6b22..918c383b0 100644 --- a/common-files/src/main/resources/translations/zh_cn.yml +++ b/common-files/src/main/resources/translations/zh_cn.yml @@ -92,6 +92,8 @@ warning.config.condition.inverted.invalid_term_type: "在文件 warning.config.condition.enchantment.missing_predicate: "在文件 发现问题 - 配置项 '' 缺少 'enchantment' 条件所需的 'predicate' 参数" warning.config.condition.enchantment.invalid_predicate: "在文件 发现问题 - 配置项 '' 使用了无效的附魔 'predicate' 参数 ''" warning.config.condition.match_block_property.missing_properties: "在文件 发现问题 - 配置项 '' 缺少 'match_block_property' 条件所需的 'properties' 参数" +warning.config.condition.match_block_type.missing_id: "在文件 发现问题 - 配置项 '' 缺少 'match_block_type' 条件所需的 'id' 参数" +warning.config.condition.match_entity_type.missing_id: "在文件 发现问题 - 配置项 '' 缺少 'match_entity_type' 条件所需的 'id' 参数" warning.config.condition.match_item.missing_id: "在文件 发现问题 - 配置项 '' 缺少 'match_item' 条件所需的 'id' 参数" warning.config.condition.table_bonus.missing_enchantment: "在文件 发现问题 - 配置项 '' 缺少 'table_bonus' 条件所需的 'enchantment' 参数" warning.config.condition.table_bonus.missing_chances: "在文件 发现问题 - 配置项 '' 缺少 'table_bonus' 条件所需的 'chances' 参数" @@ -106,6 +108,8 @@ warning.config.condition.expression.missing_expression: "在文件 在文件 发现问题 - 配置项 '' 缺少 'is_null' 条件的必需的 'argument' 参数" warning.config.condition.hand.missing_hand: "在文件 发现问题 - 配置项 '' 缺少 'hand' 条件必需的 'hand' 参数" warning.config.condition.hand.invalid_hand: "在文件 发现问题 - 配置项 '' 使用了无效的 'hand' 参数 ''('hand' 条件)。允许的手部类型: []" +warning.config.condition.gamemode.missing_gamemode: "在文件 发现问题 - 配置项 '' 缺少 'gamemode' 条件必需的 'gamemode' 参数" +warning.config.condition.gamemode.invalid_gamemode: "在文件 发现问题 - 配置项 '' 使用了无效的 'gamemode' 参数 ''('gamemode' 条件)。允许的游戏模式类型: []" warning.config.condition.on_cooldown.missing_id: "在文件 发现问题 - 配置项 '' 缺少 'on_cooldown' 条件必需的 'id' 参数" warning.config.structure.not_section: "在文件 发现问题 - 配置项 '' 应为配置段落 但实际类型为 ''" warning.config.image.duplicate: "在文件 发现问题 - 重复的图片配置 '' 请检查其他文件中是否存在相同配置" @@ -411,14 +415,14 @@ warning.config.selector.invalid_type: "在文件 中发现问题 warning.config.selector.invalid_target: "在文件 中发现问题 - 配置项 '' 使用了无效的选择器目标 ''" warning.config.resource_pack.item_model.already_exist: "无法为 '' 生成物品模型,因为文件 '' 已存在" warning.config.resource_pack.model.generation.already_exist: "无法生成模型,因为模型文件 '' 已存在" +warning.config.resource_pack.generation.malformatted_json: "Json文件 '' 格式错误" warning.config.resource_pack.generation.missing_font_texture: "字体''缺少必要纹理: ''" warning.config.resource_pack.generation.missing_model_texture: "模型''缺少纹理''" -warning.config.resource_pack.generation.texture_not_in_atlas: "纹理''不在图集内. 你需要将纹理路径或文件夹前缀添加到图集内,或者启用 config.yml 中的 'obfuscation' 选项" warning.config.resource_pack.generation.missing_item_model: "物品''缺少模型文件: ''" warning.config.resource_pack.generation.missing_block_model: "方块状态''缺少模型文件: ''" warning.config.resource_pack.generation.missing_parent_model: "模型''找不到父级模型文件: ''" -warning.config.resource_pack.generation.malformatted_json: "Json文件 '' 格式错误" warning.config.resource_pack.generation.missing_equipment_texture: "装备 '' 缺少纹理 ''" +warning.config.resource_pack.generation.texture_not_in_atlas: "纹理''不在图集内. 你需要将纹理路径或文件夹前缀添加到图集内,或者启用 config.yml 中的 'obfuscation' 选项" warning.config.resource_pack.invalid_overlay_format: "在 config.yml 的 'resource-pack.overlay-format' 处发现问题 - 无效的overlay格式 ''. Overlay格式必须包含占位符 '{version}'" warning.config.equipment.duplicate: "在文件 发现问题 - 重复的装备配置 ''。请检查其他文件中是否存在相同配置" warning.config.equipment.missing_type: "在文件 发现问题 - 装备 '' 缺少必需的 'type' 参数" diff --git a/core/src/main/java/net/momirealms/craftengine/core/entity/player/Player.java b/core/src/main/java/net/momirealms/craftengine/core/entity/player/Player.java index 956a55571..8bbcbb73b 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/entity/player/Player.java +++ b/core/src/main/java/net/momirealms/craftengine/core/entity/player/Player.java @@ -52,6 +52,14 @@ public abstract class Player extends AbstractEntity implements NetWorkUser { public abstract boolean isSneaking(); + public abstract boolean isSwimming(); + + public abstract boolean isClimbing(); + + public abstract boolean isGliding(); + + public abstract boolean isFlying(); + public abstract GameMode gameMode(); public abstract void setGameMode(GameMode gameMode); @@ -106,9 +114,9 @@ public abstract class Player extends AbstractEntity implements NetWorkUser { public abstract void performCommand(String command); - public abstract double luck(); + public abstract void performCommandAsEvent(String command); - public abstract boolean isFlying(); + public abstract double luck(); @Override public Key type() { diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/CommonConditions.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/CommonConditions.java index a5521169c..05ddbf39b 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/CommonConditions.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/CommonConditions.java @@ -2,6 +2,8 @@ package net.momirealms.craftengine.core.plugin.context.condition; import net.momirealms.craftengine.core.util.Key; +import java.util.Set; + public final class CommonConditions { private CommonConditions() {} @@ -10,6 +12,8 @@ public final class CommonConditions { public static final Key ANY_OF = Key.of("craftengine:any_of"); public static final Key INVERTED = Key.of("craftengine:inverted"); public static final Key MATCH_ITEM = Key.of("craftengine:match_item"); + public static final Key MATCH_ENTITY_TYPE = Key.of("craftengine:match_entity_type"); + public static final Key MATCH_BLOCK_TYPE = Key.of("craftengine:match_block_type"); public static final Key MATCH_BLOCK_PROPERTY = Key.from("craftengine:match_block_property"); public static final Key TABLE_BONUS = Key.from("craftengine:table_bonus"); public static final Key SURVIVES_EXPLOSION = Key.from("craftengine:survives_explosion"); @@ -26,4 +30,18 @@ public final class CommonConditions { public static final Key EXPRESSION = Key.from("craftengine:expression"); public static final Key IS_NULL = Key.from("craftengine:is_null"); public static final Key HAND = Key.from("craftengine:hand"); + + public static boolean matchObject(Key key, boolean regexMatch, Set ids) { + String id = key.toString(); + if (regexMatch) { + for (String regex : ids) { + if (id.matches(regex)) { + return true; + } + } + } else { + return ids.contains(id); + } + return false; + } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchBlockTypeCondition.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchBlockTypeCondition.java new file mode 100644 index 000000000..be8e8036e --- /dev/null +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchBlockTypeCondition.java @@ -0,0 +1,50 @@ +package net.momirealms.craftengine.core.plugin.context.condition; + +import net.momirealms.craftengine.core.block.ImmutableBlockState; +import net.momirealms.craftengine.core.plugin.context.Condition; +import net.momirealms.craftengine.core.plugin.context.Context; +import net.momirealms.craftengine.core.plugin.context.parameter.DirectContextParameters; +import net.momirealms.craftengine.core.plugin.locale.LocalizedResourceConfigException; +import net.momirealms.craftengine.core.util.Key; +import net.momirealms.craftengine.core.util.MiscUtils; +import net.momirealms.craftengine.core.util.ResourceConfigUtils; +import net.momirealms.craftengine.core.world.BlockInWorld; + +import java.util.*; + +public class MatchBlockTypeCondition implements Condition { + private final Set ids; + private final boolean regexMatch; + + public MatchBlockTypeCondition(Collection ids, boolean regexMatch) { + this.ids = new HashSet<>(ids); + this.regexMatch = regexMatch; + } + + @Override + public Key type() { + return CommonConditions.MATCH_ENTITY_TYPE; + } + + @Override + public boolean test(CTX ctx) { + Optional block = ctx.getOptionalParameter(DirectContextParameters.BLOCK); + if (block.isEmpty()) return false; + Optional customBlock = ctx.getOptionalParameter(DirectContextParameters.CUSTOM_BLOCK_STATE); + Key key = customBlock.isPresent() ? customBlock.get().owner().value().id() : block.get().type(); + return CommonConditions.matchObject(key, this.regexMatch, this.ids); + } + + public static class FactoryImpl implements ConditionFactory { + + @Override + public Condition create(Map arguments) { + List ids = MiscUtils.getAsStringList(arguments.get("id")); + if (ids.isEmpty()) { + throw new LocalizedResourceConfigException("warning.config.condition.match_block_type.missing_id"); + } + boolean regex = ResourceConfigUtils.getAsBoolean(arguments.getOrDefault("regex", false), "regex"); + return new MatchBlockTypeCondition<>(ids, regex); + } + } +} diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchEntityTypeCondition.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchEntityTypeCondition.java new file mode 100644 index 000000000..708bb4b41 --- /dev/null +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchEntityTypeCondition.java @@ -0,0 +1,48 @@ + package net.momirealms.craftengine.core.plugin.context.condition; + + import net.momirealms.craftengine.core.entity.Entity; + import net.momirealms.craftengine.core.plugin.context.Condition; + import net.momirealms.craftengine.core.plugin.context.Context; + import net.momirealms.craftengine.core.plugin.context.parameter.DirectContextParameters; + import net.momirealms.craftengine.core.plugin.locale.LocalizedResourceConfigException; + import net.momirealms.craftengine.core.util.Key; + import net.momirealms.craftengine.core.util.MiscUtils; + import net.momirealms.craftengine.core.util.ResourceConfigUtils; + + import java.util.*; + + public class MatchEntityTypeCondition implements Condition { + private final Set ids; + private final boolean regexMatch; + + public MatchEntityTypeCondition(Collection ids, boolean regexMatch) { + this.ids = new HashSet<>(ids); + this.regexMatch = regexMatch; + } + + @Override + public Key type() { + return CommonConditions.MATCH_ENTITY_TYPE; + } + + @Override + public boolean test(CTX ctx) { + Optional entity = ctx.getOptionalParameter(DirectContextParameters.ENTITY); + if (entity.isEmpty()) return false; + Key key = entity.get().type(); + return CommonConditions.matchObject(key, this.regexMatch, this.ids); + } + + public static class FactoryImpl implements ConditionFactory { + + @Override + public Condition create(Map arguments) { + List ids = MiscUtils.getAsStringList(arguments.get("id")); + if (ids.isEmpty()) { + throw new LocalizedResourceConfigException("warning.config.condition.match_entity_type.missing_id"); + } + boolean regex = ResourceConfigUtils.getAsBoolean(arguments.getOrDefault("regex", false), "regex"); + return new MatchEntityTypeCondition<>(ids, regex); + } + } + } diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchItemCondition.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchItemCondition.java index 45d14beac..41b14231a 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchItemCondition.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchItemCondition.java @@ -30,17 +30,7 @@ public class MatchItemCondition implements Condition { Optional> item = ctx.getOptionalParameter(DirectContextParameters.ITEM_IN_HAND); if (item.isEmpty()) return false; Key key = item.get().id(); - String itemId = key.toString(); - if (this.regexMatch) { - for (String regex : ids) { - if (itemId.matches(regex)) { - return true; - } - } - } else { - return this.ids.contains(itemId); - } - return false; + return CommonConditions.matchObject(key, this.regexMatch, this.ids); } public static class FactoryImpl implements ConditionFactory { diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/event/EventConditions.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/event/EventConditions.java index e5fc50979..0e3eb288a 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/event/EventConditions.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/event/EventConditions.java @@ -17,6 +17,8 @@ public class EventConditions { static { register(CommonConditions.MATCH_ITEM, new MatchItemCondition.FactoryImpl<>()); + register(CommonConditions.MATCH_ENTITY_TYPE, new MatchEntityTypeCondition.FactoryImpl<>()); + register(CommonConditions.MATCH_BLOCK_TYPE, new MatchBlockTypeCondition.FactoryImpl<>()); register(CommonConditions.MATCH_BLOCK_PROPERTY, new MatchBlockPropertyCondition.FactoryImpl<>()); register(CommonConditions.TABLE_BONUS, new TableBonusCondition.FactoryImpl<>()); register(CommonConditions.SURVIVES_EXPLOSION, new SurvivesExplosionCondition.FactoryImpl<>()); diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/function/CommandFunction.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/function/CommandFunction.java index c27b2177f..ce444cd36 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/function/CommandFunction.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/function/CommandFunction.java @@ -16,34 +16,34 @@ import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.Map; +import java.util.function.Consumer; public class CommandFunction extends AbstractConditionalFunction { private final List command; - private final boolean asPlayer; private final PlayerSelector selector; + private final boolean asPlayer; + private final boolean asEvent; - public CommandFunction(List> predicates, @Nullable PlayerSelector selector, List command, boolean asPlayer) { + public CommandFunction(List> predicates, @Nullable PlayerSelector selector, List command, boolean asPlayer, boolean asEvent) { super(predicates); - this.asPlayer = asPlayer; this.command = command; this.selector = selector; + this.asPlayer = asPlayer; + this.asEvent = asEvent; } @Override public void runInternal(CTX ctx) { if (this.asPlayer) { if (this.selector == null) { - ctx.getOptionalParameter(DirectContextParameters.PLAYER).ifPresent(it -> { - for (TextProvider c : this.command) { - it.performCommand(c.get(ctx)); - } - }); + ctx.getOptionalParameter(DirectContextParameters.PLAYER) + .ifPresent(player -> executeCommands( + ctx, this.asEvent ? player::performCommandAsEvent : player::performCommand + )); } else { for (Player viewer : this.selector.get(ctx)) { RelationalContext relationalContext = ViewerContext.of(ctx, PlayerOptionalContext.of(viewer, ContextHolder.EMPTY)); - for (TextProvider c : this.command) { - viewer.performCommand(c.get(relationalContext)); - } + executeCommands(relationalContext, this.asEvent ? viewer::performCommandAsEvent : viewer::performCommand); } } } else { @@ -54,6 +54,12 @@ public class CommandFunction extends AbstractConditionalFun } } + private void executeCommands(Context ctx, Consumer executor) { + for (TextProvider c : this.command) { + executor.accept(c.get(ctx)); + } + } + @Override public Key type() { return CommonFunctions.COMMAND; @@ -70,7 +76,8 @@ public class CommandFunction extends AbstractConditionalFun Object command = ResourceConfigUtils.requireNonNullOrThrow(ResourceConfigUtils.get(arguments, "command", "commands"), "warning.config.function.command.missing_command"); List commands = MiscUtils.getAsStringList(command).stream().map(TextProviders::fromString).toList(); boolean asPlayer = ResourceConfigUtils.getAsBoolean(arguments.getOrDefault("as-player", false), "as-player"); - return new CommandFunction<>(getPredicates(arguments), PlayerSelectors.fromObject(arguments.get("target"), conditionFactory()), commands, asPlayer); + boolean asEvent = ResourceConfigUtils.getAsBoolean(arguments.getOrDefault("as-event", false), "as-event"); + return new CommandFunction<>(getPredicates(arguments), PlayerSelectors.fromObject(arguments.get("target"), conditionFactory()), commands, asPlayer, asEvent); } } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/parameter/DirectContextParameters.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/parameter/DirectContextParameters.java index cf98e3774..92b3982c9 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/parameter/DirectContextParameters.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/parameter/DirectContextParameters.java @@ -57,8 +57,11 @@ public final class DirectContextParameters { public static final ContextKey ANCHOR_TYPE = ContextKey.direct("anchor_type"); public static final ContextKey HAND = ContextKey.direct("hand"); public static final ContextKey EVENT = ContextKey.direct("event"); - public static final ContextKey IS_FLYING = ContextKey.direct("is_flying"); public static final ContextKey IS_SNEAKING = ContextKey.direct("is_sneaking"); + public static final ContextKey IS_SWIMMING = ContextKey.direct("is_swimming"); + public static final ContextKey IS_CLIMBING = ContextKey.direct("is_climbing"); + public static final ContextKey IS_GLIDING = ContextKey.direct("is_gliding"); + public static final ContextKey IS_FLYING = ContextKey.direct("is_flying"); public static final ContextKey IS_CUSTOM = ContextKey.direct("is_custom"); public static final ContextKey IS_BLOCK_ITEM = ContextKey.direct("is_block_item"); public static final ContextKey GAMEMODE = ContextKey.direct("gamemode"); diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/parameter/PlayerParameterProvider.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/parameter/PlayerParameterProvider.java index 7ed66aff2..25c3df127 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/parameter/PlayerParameterProvider.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/parameter/PlayerParameterProvider.java @@ -29,8 +29,11 @@ public class PlayerParameterProvider implements ChainParameterProvider { CONTEXT_FUNCTIONS.put(DirectContextParameters.NAME, Player::name); CONTEXT_FUNCTIONS.put(DirectContextParameters.UUID, Player::uuid); CONTEXT_FUNCTIONS.put(DirectContextParameters.WORLD, Entity::world); - CONTEXT_FUNCTIONS.put(DirectContextParameters.IS_FLYING, Player::isFlying); CONTEXT_FUNCTIONS.put(DirectContextParameters.IS_SNEAKING, Player::isSneaking); + CONTEXT_FUNCTIONS.put(DirectContextParameters.IS_SWIMMING, Player::isSwimming); + CONTEXT_FUNCTIONS.put(DirectContextParameters.IS_CLIMBING, Player::isClimbing); + CONTEXT_FUNCTIONS.put(DirectContextParameters.IS_GLIDING, Player::isGliding); + CONTEXT_FUNCTIONS.put(DirectContextParameters.IS_FLYING, Player::isFlying); CONTEXT_FUNCTIONS.put(DirectContextParameters.GAMEMODE, Player::gameMode); CONTEXT_FUNCTIONS.put(DirectContextParameters.MAIN_HAND_ITEM, p -> p.getItemInHand(InteractionHand.MAIN_HAND)); CONTEXT_FUNCTIONS.put(DirectContextParameters.OFF_HAND_ITEM, p -> p.getItemInHand(InteractionHand.OFF_HAND)); diff --git a/core/src/main/java/net/momirealms/craftengine/core/sound/SoundSource.java b/core/src/main/java/net/momirealms/craftengine/core/sound/SoundSource.java index e48a6c429..a3174292d 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/sound/SoundSource.java +++ b/core/src/main/java/net/momirealms/craftengine/core/sound/SoundSource.java @@ -12,7 +12,8 @@ public enum SoundSource { NEUTRAL("neutral"), PLAYER("player"), AMBIENT("ambient"), - VOICE("voice"); + VOICE("voice"), + UI("ui"); private final String id; diff --git a/core/src/main/java/net/momirealms/craftengine/core/world/BlockInWorld.java b/core/src/main/java/net/momirealms/craftengine/core/world/BlockInWorld.java index 5dac8cf13..9ac55192d 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/world/BlockInWorld.java +++ b/core/src/main/java/net/momirealms/craftengine/core/world/BlockInWorld.java @@ -3,6 +3,7 @@ package net.momirealms.craftengine.core.world; import net.momirealms.craftengine.core.block.CustomBlock; import net.momirealms.craftengine.core.block.ImmutableBlockState; import net.momirealms.craftengine.core.item.context.BlockPlaceContext; +import net.momirealms.craftengine.core.util.Key; import org.jetbrains.annotations.Nullable; public interface BlockInWorld { @@ -27,6 +28,8 @@ public interface BlockInWorld { World world(); + Key type(); + int x(); int y(); From 0bdfdcd40a667d5daf6f0ced4dc2e8897638e954 Mon Sep 17 00:00:00 2001 From: halogly Date: Sat, 23 Aug 2025 16:00:01 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E7=A7=BB=E5=8A=A8matchObject=E5=88=B0MiscU?= =?UTF-8?q?til=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../context/condition/CommonConditions.java | 14 -------------- .../condition/MatchBlockTypeCondition.java | 2 +- .../condition/MatchEntityTypeCondition.java | 2 +- .../context/condition/MatchItemCondition.java | 2 +- .../craftengine/core/util/MiscUtils.java | 19 +++++++++++++++---- 5 files changed, 18 insertions(+), 21 deletions(-) diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/CommonConditions.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/CommonConditions.java index 05ddbf39b..1283a89da 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/CommonConditions.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/CommonConditions.java @@ -30,18 +30,4 @@ public final class CommonConditions { public static final Key EXPRESSION = Key.from("craftengine:expression"); public static final Key IS_NULL = Key.from("craftengine:is_null"); public static final Key HAND = Key.from("craftengine:hand"); - - public static boolean matchObject(Key key, boolean regexMatch, Set ids) { - String id = key.toString(); - if (regexMatch) { - for (String regex : ids) { - if (id.matches(regex)) { - return true; - } - } - } else { - return ids.contains(id); - } - return false; - } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchBlockTypeCondition.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchBlockTypeCondition.java index be8e8036e..b8d825437 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchBlockTypeCondition.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchBlockTypeCondition.java @@ -32,7 +32,7 @@ public class MatchBlockTypeCondition implements Condition customBlock = ctx.getOptionalParameter(DirectContextParameters.CUSTOM_BLOCK_STATE); Key key = customBlock.isPresent() ? customBlock.get().owner().value().id() : block.get().type(); - return CommonConditions.matchObject(key, this.regexMatch, this.ids); + return MiscUtils.matchObject(key, this.regexMatch, this.ids); } public static class FactoryImpl implements ConditionFactory { diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchEntityTypeCondition.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchEntityTypeCondition.java index 708bb4b41..5f51872ab 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchEntityTypeCondition.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchEntityTypeCondition.java @@ -30,7 +30,7 @@ Optional entity = ctx.getOptionalParameter(DirectContextParameters.ENTITY); if (entity.isEmpty()) return false; Key key = entity.get().type(); - return CommonConditions.matchObject(key, this.regexMatch, this.ids); + return MiscUtils.matchObject(key, this.regexMatch, this.ids); } public static class FactoryImpl implements ConditionFactory { diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchItemCondition.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchItemCondition.java index 41b14231a..4ba82709f 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchItemCondition.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchItemCondition.java @@ -30,7 +30,7 @@ public class MatchItemCondition implements Condition { Optional> item = ctx.getOptionalParameter(DirectContextParameters.ITEM_IN_HAND); if (item.isEmpty()) return false; Key key = item.get().id(); - return CommonConditions.matchObject(key, this.regexMatch, this.ids); + return MiscUtils.matchObject(key, this.regexMatch, this.ids); } public static class FactoryImpl implements ConditionFactory { 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 54195dff8..77853bb18 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 @@ -4,10 +4,7 @@ import net.momirealms.craftengine.core.plugin.locale.LocalizedResourceConfigExce import org.joml.Quaternionf; import org.joml.Vector3f; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; public class MiscUtils { @@ -153,4 +150,18 @@ public class MiscUtils { return o; } } + + public static boolean matchObject(Key key, boolean regexMatch, Set ids) { + String id = key.toString(); + if (regexMatch) { + for (String regex : ids) { + if (id.matches(regex)) { + return true; + } + } + } else { + return ids.contains(id); + } + return false; + } } From bc3170738b05c211e5a68c550ac0d881eefee3b0 Mon Sep 17 00:00:00 2001 From: halogly Date: Sat, 23 Aug 2025 16:00:57 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/plugin/context/condition/CommonConditions.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/CommonConditions.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/CommonConditions.java index 1283a89da..445406954 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/CommonConditions.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/CommonConditions.java @@ -2,8 +2,6 @@ package net.momirealms.craftengine.core.plugin.context.condition; import net.momirealms.craftengine.core.util.Key; -import java.util.Set; - public final class CommonConditions { private CommonConditions() {} From 719c2cd92e9193908046dd27cee113199870f29f Mon Sep 17 00:00:00 2001 From: halogly Date: Sat, 23 Aug 2025 17:15:33 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common-files/src/main/resources/translations/de.yml | 2 -- common-files/src/main/resources/translations/en.yml | 2 -- common-files/src/main/resources/translations/ru_ru.yml | 2 -- common-files/src/main/resources/translations/zh_cn.yml | 2 -- 4 files changed, 8 deletions(-) diff --git a/common-files/src/main/resources/translations/de.yml b/common-files/src/main/resources/translations/de.yml index 99b377def..3e3ffe8b1 100644 --- a/common-files/src/main/resources/translations/de.yml +++ b/common-files/src/main/resources/translations/de.yml @@ -106,8 +106,6 @@ warning.config.condition.expression.missing_expression: "Problem in Date warning.config.condition.is_null.missing_argument: "Problem in Datei gefunden - Bei der Config '' fehlt das erforderliche 'argument'-Argument für die 'is_null'-Bedingung." warning.config.condition.hand.missing_hand: "Problem in Datei gefunden - Bei der Config '' fehlt das erforderliche 'hand'-Argument für die 'hand'-Bedingung." warning.config.condition.hand.invalid_hand: "Problem in Datei gefunden - Die Config '' verwendet ein ungültiges 'hand'-Argument '' für die 'hand'-Bedingung. Erlaubte Hand-Typen: []" -warning.config.condition.gamemode.missing_gamemode: "Problem in Datei gefunden - Der Konfiguration '' fehlt das erforderliche 'gamemode'-Argument für die 'gamemode'-Bedingung." -warning.config.condition.gamemode.invalid_gamemode: "Problem in Datei gefunden - Die Konfiguration '' verwendet ein ungültiges 'gamemode'-Argument '' für die 'gamemode'-Bedingung. Erlaubte Handtypen: []" warning.config.condition.on_cooldown.missing_id: "Problem in Datei gefunden - Bei der Config '' fehlt das erforderliche 'id'-Argument für die 'on_cooldown'-Bedingung." warning.config.structure.not_section: "Problem in Datei gefunden - Die Config '' wird als Config-Abschnitt erwartet, ist aber tatsächlich ein(e) ''." warning.config.image.duplicate: "Problem in Datei gefunden - Doppeltes Image ''. Bitte prüfe, ob dieselbe Konfiguration in anderen Dateien vorhanden ist." diff --git a/common-files/src/main/resources/translations/en.yml b/common-files/src/main/resources/translations/en.yml index 3a73bd5d4..eab94b9de 100644 --- a/common-files/src/main/resources/translations/en.yml +++ b/common-files/src/main/resources/translations/en.yml @@ -108,8 +108,6 @@ warning.config.condition.expression.missing_expression: "Issue found in warning.config.condition.is_null.missing_argument: "Issue found in file - The config '' is missing the required 'argument' argument for 'is_null' condition." warning.config.condition.hand.missing_hand: "Issue found in file - The config '' is missing the required 'hand' argument for 'hand' condition." warning.config.condition.hand.invalid_hand: "Issue found in file - The config '' is using an invalid 'hand' argument '' for 'hand' condition. Allowed hand types: []" -warning.config.condition.gamemode.missing_gamemode: "Issue found in file - The config '' is missing the required 'gamemode' argument for 'gamemode' condition." -warning.config.condition.gamemode.invalid_gamemode: "Issue found in file - The config '' is using an invalid 'gamemode' argument '' for 'gamemode' condition. Allowed gamemode types: []" warning.config.condition.on_cooldown.missing_id: "Issue found in file - The config '' is missing the required 'id' argument for 'on_cooldown' condition." 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 ''. Please check if there is the same configuration in other files." diff --git a/common-files/src/main/resources/translations/ru_ru.yml b/common-files/src/main/resources/translations/ru_ru.yml index 120af2f0e..60036cb99 100644 --- a/common-files/src/main/resources/translations/ru_ru.yml +++ b/common-files/src/main/resources/translations/ru_ru.yml @@ -104,8 +104,6 @@ warning.config.condition.expression.missing_expression: "Проблем warning.config.condition.is_null.missing_argument: "Проблема найдена в файле - В конфигурации '' отсутствует необходимый 'argument' аргумент для 'is_null' состояния." warning.config.condition.hand.missing_hand: "Проблема найдена в файле - В конфигурации '' отсутствует необходимый 'hand' аргумент для 'hand' состояния." warning.config.condition.hand.invalid_hand: "Проблема найдена в файле - В конфигурации '' использует недействительный 'hand' аргумент '' для 'hand' состояния. Допустимые типы рук: []" -warning.config.condition.gamemode.missing_gamemode: "Проблема найдена в файле - В конфигурации '' отсутствует необходимый 'gamemode' аргумент для 'gamemode' состояния." -warning.config.condition.gamemode.invalid_gamemode: "Проблема найдена в файле - В конфигурации '' использует недействительный 'gamemode' аргумент '' для 'gamemode' состояния. Допустимые типы режимов игры: []" warning.config.condition.on_cooldown.missing_id: "Проблема найдена в файле - В конфигурации '' отсутствует необходимый 'id' аргумент для 'on_cooldown' состояния." warning.config.structure.not_section: "Проблема найдена в файле - В конфигурации '' ожидается, что это будет раздел конфигурации, хотя на самом деле это a(n) ''." warning.config.image.duplicate: "Проблема найдена в файле - Дублированное изображение ''. Проверьте, есть ли такая же конфигурация в других файлах." diff --git a/common-files/src/main/resources/translations/zh_cn.yml b/common-files/src/main/resources/translations/zh_cn.yml index 918c383b0..eeaff9665 100644 --- a/common-files/src/main/resources/translations/zh_cn.yml +++ b/common-files/src/main/resources/translations/zh_cn.yml @@ -108,8 +108,6 @@ warning.config.condition.expression.missing_expression: "在文件 在文件 发现问题 - 配置项 '' 缺少 'is_null' 条件的必需的 'argument' 参数" warning.config.condition.hand.missing_hand: "在文件 发现问题 - 配置项 '' 缺少 'hand' 条件必需的 'hand' 参数" warning.config.condition.hand.invalid_hand: "在文件 发现问题 - 配置项 '' 使用了无效的 'hand' 参数 ''('hand' 条件)。允许的手部类型: []" -warning.config.condition.gamemode.missing_gamemode: "在文件 发现问题 - 配置项 '' 缺少 'gamemode' 条件必需的 'gamemode' 参数" -warning.config.condition.gamemode.invalid_gamemode: "在文件 发现问题 - 配置项 '' 使用了无效的 'gamemode' 参数 ''('gamemode' 条件)。允许的游戏模式类型: []" warning.config.condition.on_cooldown.missing_id: "在文件 发现问题 - 配置项 '' 缺少 'on_cooldown' 条件必需的 'id' 参数" warning.config.structure.not_section: "在文件 发现问题 - 配置项 '' 应为配置段落 但实际类型为 ''" warning.config.image.duplicate: "在文件 发现问题 - 重复的图片配置 '' 请检查其他文件中是否存在相同配置"