9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2026-01-06 15:52:03 +00:00

feat(core): 添加查看物品配方和用法功能

This commit is contained in:
jhqwqmc
2025-03-16 18:58:54 +08:00
parent 20d0326828
commit 7f77bf16ff
6 changed files with 7 additions and 1 deletions

View File

@@ -49,4 +49,5 @@ command.item.get.failure.not_exist: "<red><lang:argument.item.id.invalid:'<arg:0
command.item.give.success.single: "<lang:commands.give.success.single:'<arg:0>':'<arg:1>':'<arg:2>'>"
command.item.give.success.multiple: "<lang:commands.give.success.multiple:'<arg:0>':'<arg:1>':'<arg:2>'>"
command.item.give.failure.not_exist: "<red><lang:argument.item.id.invalid:'<arg:0>'></red>"
command.item.recipe.browser.recipe.no_found: "<red>No recipe found for this item</red>"
command.item.usage.browser.recipe.no_found: "<red>No usage found for this item</red>"

View File

@@ -49,4 +49,5 @@ command.item.get.failure.not_exist: "<red><lang:argument.item.id.invalid:'<arg:0
command.item.give.success.single: "<lang:commands.give.success.single:'<arg:0>':'<arg:1>':'<arg:2>'>"
command.item.give.success.multiple: "<lang:commands.give.success.multiple:'<arg:0>':'<arg:1>':'<arg:2>'>"
command.item.give.failure.not_exist: "<red><lang:argument.item.id.invalid:'<arg:0>'></red>"
command.item.recipe.browser.recipe.no_found: "<red>No recipe found for this item</red>"
command.item.usage.browser.recipe.no_found: "<red>No usage found for this item</red>"

View File

@@ -49,4 +49,5 @@ command.item.get.failure.not_exist: "<red><lang:argument.item.id.invalid:'<arg:0
command.item.give.success.single: "<lang:commands.give.success.single:'<arg:0>':'<arg:1>':'<arg:2>'>"
command.item.give.success.multiple: "<lang:commands.give.success.multiple:'<arg:0>':'<arg:1>':'<arg:2>'>"
command.item.give.failure.not_exist: "<red><lang:argument.item.id.invalid:'<arg:0>'></red>"
command.item.recipe.browser.recipe.no_found: "<red>找不到此物品的配方</red>"
command.item.usage.browser.recipe.no_found: "<red>找不到此物品的用法</red>"

View File

@@ -49,4 +49,5 @@ command.item.get.failure.not_exist: "<red><lang:argument.item.id.invalid:'<arg:0
command.item.give.success.single: "<lang:commands.give.success.single:'<arg:0>':'<arg:1>':'<arg:2>'>"
command.item.give.success.multiple: "<lang:commands.give.success.multiple:'<arg:0>':'<arg:1>':'<arg:2>'>"
command.item.give.failure.not_exist: "<red><lang:argument.item.id.invalid:'<arg:0>'></red>"
command.item.recipe.browser.recipe.no_found: "<red>找不到此物品的配方</red>"
command.item.usage.browser.recipe.no_found: "<red>找不到此物品的用法</red>"

View File

@@ -5,6 +5,7 @@ import net.momirealms.craftengine.bukkit.plugin.user.BukkitServerPlayer;
import net.momirealms.craftengine.core.item.recipe.Recipe;
import net.momirealms.craftengine.core.plugin.CraftEngine;
import net.momirealms.craftengine.core.plugin.command.CraftEngineCommandManager;
import net.momirealms.craftengine.core.plugin.locale.MessageConstants;
import net.momirealms.craftengine.core.util.Key;
import org.bukkit.NamespacedKey;
import org.bukkit.command.CommandSender;
@@ -46,7 +47,7 @@ public class ItemRecipeBrowserCommand extends BukkitCommandFeature<CommandSender
if (!inRecipes.isEmpty()) {
plugin().itemBrowserManager().openRecipePage(serverPlayer, null, inRecipes, 0, 0);
} else {
plugin().itemBrowserManager().openNoRecipePage(serverPlayer, itemId, null, 0);
handleFeedback(context, MessageConstants.COMMAND_ITEM_RECIPE_BROWSER_RECIPE_NO_FOUND);
}
});
}

View File

@@ -16,5 +16,6 @@ public interface MessageConstants {
TranslatableComponent.Builder COMMAND_ITEM_GIVE_SUCCESS_SINGLE = Component.translatable().key("command.item.give.success.single");
TranslatableComponent.Builder COMMAND_ITEM_GIVE_SUCCESS_MULTIPLE = Component.translatable().key("command.item.give.success.multiple");
TranslatableComponent.Builder COMMAND_ITEM_GIVE_FAILURE_NOT_EXIST = Component.translatable().key("command.item.give.failure.not_exist");
TranslatableComponent.Builder COMMAND_ITEM_RECIPE_BROWSER_RECIPE_NO_FOUND = Component.translatable().key("command.item.recipe.browser.recipe.no_found");
TranslatableComponent.Builder COMMAND_ITEM_USAGE_BROWSER_RECIPE_NO_FOUND = Component.translatable().key("command.item.usage.browser.recipe.no_found");
}