From fa18c3913ebefe5783162ef7c4579957ec0456a0 Mon Sep 17 00:00:00 2001 From: YufiriaMazenta <2199098065@qq.com> Date: Fri, 29 Dec 2023 10:46:19 +0800 Subject: [PATCH] =?UTF-8?q?[1.8.0-beta3]=E9=85=8D=E6=96=B9=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E9=A1=B5=E9=9D=A2=E6=96=B0=E5=A2=9E=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E9=85=8D=E6=96=B9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 4 +- .../craftorithm/config/Languages.java | 2 + .../menu/display/RecipeGroupListMenu.java | 97 +++++++++++-------- .../menu/editor/AnvilRecipeGroupEditor.java | 7 +- .../menu/editor/CookingRecipeGroupEditor.java | 7 +- .../editor/CraftingRecipeGroupEditor.java | 6 +- .../menu/editor/PotionMixGroupEditor.java | 5 +- .../menu/editor/RecipeGroupEditor.java | 29 +++++- .../editor/SmithingRecipeGroupEditor.java | 5 +- .../editor/StoneCuttingRecipeGroupEditor.java | 5 +- .../editor/UnlockableRecipeGroupEditor.java | 4 +- src/main/resources/lang/en_us.yml | 3 + src/main/resources/lang/zh_cn.yml | 3 + 13 files changed, 111 insertions(+), 66 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index f4d665a7..baa2eceb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ import java.text.SimpleDateFormat -version = "1.8.0-beta2" +version = "1.8.0-beta3" plugins { `java-library` @@ -40,7 +40,7 @@ dependencies { compileOnly("io.lumine:Mythic-Dist:5.3.5") compileOnly("io.lumine:MythicLib-dist:1.6.2-SNAPSHOT") compileOnly("net.Indyuce:MMOItems-API:6.9.5-SNAPSHOT") - implementation("com.crypticlib:CrypticLib:0.10.22") + implementation("com.crypticlib:CrypticLib:0.10.23") } group = "com.github.yufiriamazenta" diff --git a/src/main/java/com/github/yufiriamazenta/craftorithm/config/Languages.java b/src/main/java/com/github/yufiriamazenta/craftorithm/config/Languages.java index a3e0ec10..b15589c7 100644 --- a/src/main/java/com/github/yufiriamazenta/craftorithm/config/Languages.java +++ b/src/main/java/com/github/yufiriamazenta/craftorithm/config/Languages.java @@ -94,6 +94,8 @@ public class Languages { public static final StringLangConfigEntry MENU_RECIPE_EDITOR_ICON_COOKING_ELEMENT_TYPE_NAME_CAMPFIRE = new StringLangConfigEntry("menu.recipe_editor.icon.cooking_element.type_name.campfire"); public static final StringListLangConfigEntry MENU_RECIPE_EDITOR_ICON_ANVIL_ELEMENT_LORE = new StringListLangConfigEntry("menu.recipe_editor.icon.anvil_element.lore"); public static final StringLangConfigEntry MENU_RECIPE_EDITOR_ICON_ANVIL_ELEMENT_INPUT_HINT = new StringLangConfigEntry("menu.recipe_editor.icon.anvil_element.input_hint"); + public static final StringLangConfigEntry MENU_RECIPE_EDITOR_ICON_REMOVE_NAME = new StringLangConfigEntry("menu.recipe_editor.icon.remove.name"); + public static final StringLangConfigEntry MENU_RECIPE_EDITOR_ICON_REMOVE_MESSAGE = new StringLangConfigEntry("menu.recipe_editor.icon.remove.message"); public static final StringLangConfigEntry ARCENCIEL_NOT_ENOUGH_PARAM = new StringLangConfigEntry("arcenciel.not_enough_param"); public static final StringLangConfigEntry ARCENCIEL_UNKNOWN_TOKEN = new StringLangConfigEntry("arcenciel.unknown_token"); public static final StringLangConfigEntry LOAD_FINISH = new StringLangConfigEntry("load.finish"); diff --git a/src/main/java/com/github/yufiriamazenta/craftorithm/menu/display/RecipeGroupListMenu.java b/src/main/java/com/github/yufiriamazenta/craftorithm/menu/display/RecipeGroupListMenu.java index 54201f6f..46463944 100644 --- a/src/main/java/com/github/yufiriamazenta/craftorithm/menu/display/RecipeGroupListMenu.java +++ b/src/main/java/com/github/yufiriamazenta/craftorithm/menu/display/RecipeGroupListMenu.java @@ -23,41 +23,20 @@ import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.function.BiFunction; public class RecipeGroupListMenu extends Menu { private int page; - private final int maxPage; - private final List> recipeGroupResultList; - private final Map> recipeGroupEditorMap; + private int maxPage; + private List> recipeGroupResultList; + private final Map> recipeGroupEditorMap; public RecipeGroupListMenu(Player player) { super(player); - Map recipeResultMap = new HashMap<>(); - RecipeManager.INSTANCE.recipeMap().forEach((recipeType, recipeGroupMap) -> - recipeGroupMap.forEach((groupName, recipeGroup) -> { - if (recipeGroup == null || recipeGroup.isEmpty()) - return; - Recipe firstRecipe = RecipeManager.INSTANCE.getRecipe(recipeGroup.groupRecipeKeys().get(0)); - if (firstRecipe == null) - return; - recipeResultMap.put(groupName, firstRecipe.getResult()); - }) - ); - recipeGroupResultList = new ArrayList<>(recipeResultMap.entrySet()); - page = 0; - int recipeGroupNum = recipeResultMap.size(); - if (recipeGroupNum % 45 == 0) { - maxPage = recipeGroupNum / 45; - } else { - maxPage = recipeGroupNum / 45 + 1; - } - recipeGroupResultList.sort((o1, o2) -> { - int sortId = RecipeManager.INSTANCE.getRecipeGroupSortId(o1.getKey()); - int sortId2 = RecipeManager.INSTANCE.getRecipeGroupSortId(o2.getKey()); - return Integer.compare(sortId, sortId2); - }); + recipeGroupResultList = new CopyOnWriteArrayList<>(); + refreshRecipes(); recipeGroupEditorMap = new ConcurrentHashMap<>(); recipeGroupEditorMap.put(RecipeType.SHAPED, CraftingRecipeGroupEditor::new); @@ -74,34 +53,57 @@ public RecipeGroupListMenu(Player player) { @Override public Inventory getInventory() { resetIcons(); - Inventory inventory = Bukkit.createInventory( - this, - 54, - TextProcessor.color(Languages.MENU_NEW_RECIPE_LIST_TITLE.value(player)) - ); - for (Integer slot : super.slotMap.keySet()) { - inventory.setItem(slot, slotMap.get(slot).display()); + if (openedInventory == null) { + openedInventory = Bukkit.createInventory( + this, + 54, + TextProcessor.color(Languages.MENU_NEW_RECIPE_LIST_TITLE.value(player)) + ); } - return inventory; + refreshInventory(); + + return openedInventory; } public void nextPage() { setPage(Math.min(page + 1, maxPage - 1)).resetIcons(); - openedInventory.clear(); - for (Integer slot : slotMap.keySet()) { - openedInventory.setItem(slot, slotMap.get(slot).display()); - } + refreshInventory(); } public void previousPage() { setPage(Math.max(page - 1, 0)).resetIcons(); - openedInventory.clear(); - for (Integer slot : slotMap.keySet()) { - openedInventory.setItem(slot, slotMap.get(slot).display()); + refreshInventory(); + } + + public RecipeGroupListMenu refreshRecipes() { + Map recipeResultMap = new HashMap<>(); + RecipeManager.INSTANCE.recipeMap().forEach((recipeType, recipeGroupMap) -> + recipeGroupMap.forEach((groupName, recipeGroup) -> { + if (recipeGroup == null || recipeGroup.isEmpty()) + return; + Recipe firstRecipe = RecipeManager.INSTANCE.getRecipe(recipeGroup.groupRecipeKeys().get(0)); + if (firstRecipe == null) + return; + recipeResultMap.put(groupName, firstRecipe.getResult()); + }) + ); + recipeGroupResultList = new CopyOnWriteArrayList<>(recipeResultMap.entrySet()); + page = 0; + int recipeGroupNum = recipeResultMap.size(); + if (recipeGroupNum % 45 == 0) { + maxPage = recipeGroupNum / 45; + } else { + maxPage = recipeGroupNum / 45 + 1; } + recipeGroupResultList.sort((o1, o2) -> { + int sortId = RecipeManager.INSTANCE.getRecipeGroupSortId(o1.getKey()); + int sortId2 = RecipeManager.INSTANCE.getRecipeGroupSortId(o2.getKey()); + return Integer.compare(sortId, sortId2); + }); + return this; } - private void resetIcons() { + public RecipeGroupListMenu resetIcons() { slotMap.clear(); int []frameSlots = {45, 47, 48, 49, 50, 51, 53}; Icon frameIcon = new Icon( @@ -130,6 +132,15 @@ private void resetIcons() { continue; slotMap.put(i, new Icon(new ItemStack(Material.AIR))); } + return this; + } + + public RecipeGroupListMenu refreshInventory() { + openedInventory.clear(); + for (Integer slot : slotMap.keySet()) { + openedInventory.setItem(slot, slotMap.get(slot).display()); + } + return this; } @NotNull diff --git a/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/AnvilRecipeGroupEditor.java b/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/AnvilRecipeGroupEditor.java index 07a80391..75ccf380 100644 --- a/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/AnvilRecipeGroupEditor.java +++ b/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/AnvilRecipeGroupEditor.java @@ -3,6 +3,7 @@ import com.github.yufiriamazenta.craftorithm.Craftorithm; import com.github.yufiriamazenta.craftorithm.config.Languages; import com.github.yufiriamazenta.craftorithm.item.ItemManager; +import com.github.yufiriamazenta.craftorithm.menu.display.RecipeGroupListMenu; import com.github.yufiriamazenta.craftorithm.recipe.RecipeGroup; import crypticlib.chat.TextProcessor; import crypticlib.config.ConfigWrapper; @@ -12,7 +13,6 @@ import crypticlib.ui.display.Icon; import crypticlib.ui.display.MenuDisplay; import crypticlib.ui.display.MenuLayout; -import crypticlib.ui.menu.Menu; import net.md_5.bungee.api.chat.BaseComponent; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; @@ -27,14 +27,14 @@ public class AnvilRecipeGroupEditor extends RecipeGroupEditor { private final List anvilRecipeSourceList = new ArrayList<>(); - public AnvilRecipeGroupEditor(@NotNull Player player, @NotNull RecipeGroup recipeGroup, Menu parent) { + public AnvilRecipeGroupEditor(@NotNull Player player, @NotNull RecipeGroup recipeGroup, RecipeGroupListMenu parent) { super(player, recipeGroup, parent); setDisplay( new MenuDisplay( title, new MenuLayout( Arrays.asList( - "####A####", + "####A###Z", "X%%%%%%%Y", "#########" ), @@ -44,6 +44,7 @@ public AnvilRecipeGroupEditor(@NotNull Player player, @NotNull RecipeGroup recip iconMap.put('A', getSortIdEditIcon(4)); iconMap.put('X', getPreviousIcon()); iconMap.put('Y', getNextIcon()); + iconMap.put('Z', getRemoveIcon()); //TODO condition和action return iconMap; } diff --git a/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/CookingRecipeGroupEditor.java b/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/CookingRecipeGroupEditor.java index 13c1d6d6..d83ce1e5 100644 --- a/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/CookingRecipeGroupEditor.java +++ b/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/CookingRecipeGroupEditor.java @@ -3,6 +3,7 @@ import com.github.yufiriamazenta.craftorithm.Craftorithm; import com.github.yufiriamazenta.craftorithm.config.Languages; import com.github.yufiriamazenta.craftorithm.item.ItemManager; +import com.github.yufiriamazenta.craftorithm.menu.display.RecipeGroupListMenu; import com.github.yufiriamazenta.craftorithm.recipe.RecipeGroup; import com.github.yufiriamazenta.craftorithm.recipe.registry.impl.CookingRecipeRegistry; import com.github.yufiriamazenta.craftorithm.util.ItemUtils; @@ -13,7 +14,6 @@ import crypticlib.ui.display.Icon; import crypticlib.ui.display.MenuDisplay; import crypticlib.ui.display.MenuLayout; -import crypticlib.ui.menu.Menu; import crypticlib.util.ItemUtil; import net.md_5.bungee.api.chat.BaseComponent; import org.bukkit.configuration.file.YamlConfiguration; @@ -28,14 +28,14 @@ public class CookingRecipeGroupEditor extends UnlockableRecipeGroupEditor { private final List cookingRecipeSourceList = new ArrayList<>(); - public CookingRecipeGroupEditor(@NotNull Player player, @NotNull RecipeGroup recipeGroup, Menu parent) { + public CookingRecipeGroupEditor(@NotNull Player player, @NotNull RecipeGroup recipeGroup, RecipeGroupListMenu parent) { super(player, recipeGroup, parent); setDisplay( new MenuDisplay( title, new MenuLayout( Arrays.asList( - "###A#B###", + "###A#B##Z", "X%%%%%%%Y", "#########" ), @@ -46,6 +46,7 @@ public CookingRecipeGroupEditor(@NotNull Player player, @NotNull RecipeGroup rec layoutMap.put('#', getFrameIcon()); layoutMap.put('X', getPreviousIcon()); layoutMap.put('Y', getNextIcon()); + layoutMap.put('Z', getRemoveIcon()); return layoutMap; } ) diff --git a/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/CraftingRecipeGroupEditor.java b/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/CraftingRecipeGroupEditor.java index 84d8f6b2..b26e116b 100644 --- a/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/CraftingRecipeGroupEditor.java +++ b/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/CraftingRecipeGroupEditor.java @@ -1,21 +1,20 @@ package com.github.yufiriamazenta.craftorithm.menu.editor; +import com.github.yufiriamazenta.craftorithm.menu.display.RecipeGroupListMenu; import com.github.yufiriamazenta.craftorithm.recipe.RecipeGroup; import crypticlib.ui.display.Icon; import crypticlib.ui.display.MenuDisplay; import crypticlib.ui.display.MenuLayout; -import crypticlib.ui.menu.Menu; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Map; public class CraftingRecipeGroupEditor extends UnlockableRecipeGroupEditor { - public CraftingRecipeGroupEditor(@NotNull Player player, @NotNull RecipeGroup recipeGroup, Menu parent) { + public CraftingRecipeGroupEditor(@NotNull Player player, @NotNull RecipeGroup recipeGroup, RecipeGroupListMenu parent) { super(player, recipeGroup, parent); setDisplay( new MenuDisplay( @@ -28,6 +27,7 @@ public CraftingRecipeGroupEditor(@NotNull Player player, @NotNull RecipeGroup re Map iconMap = new HashMap<>(); iconMap.put('A', getSortIdEditIcon(0)); iconMap.put('B', getUnlockIcon()); + iconMap.put('I', getRemoveIcon()); //TODO condition和action return iconMap; } diff --git a/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/PotionMixGroupEditor.java b/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/PotionMixGroupEditor.java index 442056f4..64e7c0a9 100644 --- a/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/PotionMixGroupEditor.java +++ b/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/PotionMixGroupEditor.java @@ -1,10 +1,10 @@ package com.github.yufiriamazenta.craftorithm.menu.editor; +import com.github.yufiriamazenta.craftorithm.menu.display.RecipeGroupListMenu; import com.github.yufiriamazenta.craftorithm.recipe.RecipeGroup; import crypticlib.ui.display.Icon; import crypticlib.ui.display.MenuDisplay; import crypticlib.ui.display.MenuLayout; -import crypticlib.ui.menu.Menu; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -14,7 +14,7 @@ public class PotionMixGroupEditor extends RecipeGroupEditor { - public PotionMixGroupEditor(@NotNull Player player, @NotNull RecipeGroup recipeGroup, Menu parent) { + public PotionMixGroupEditor(@NotNull Player player, @NotNull RecipeGroup recipeGroup, RecipeGroupListMenu parent) { super(player, recipeGroup, parent); setDisplay( new MenuDisplay( @@ -26,6 +26,7 @@ public PotionMixGroupEditor(@NotNull Player player, @NotNull RecipeGroup recipeG () -> { Map iconMap = new HashMap<>(); iconMap.put('A', getSortIdEditIcon(0)); + iconMap.put('I', getRemoveIcon()); return iconMap; } ) diff --git a/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/RecipeGroupEditor.java b/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/RecipeGroupEditor.java index 289c7da3..fc31a4e2 100644 --- a/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/RecipeGroupEditor.java +++ b/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/RecipeGroupEditor.java @@ -2,9 +2,13 @@ import com.github.yufiriamazenta.craftorithm.Craftorithm; import com.github.yufiriamazenta.craftorithm.config.Languages; +import com.github.yufiriamazenta.craftorithm.menu.display.RecipeGroupListMenu; import com.github.yufiriamazenta.craftorithm.recipe.RecipeGroup; import com.github.yufiriamazenta.craftorithm.recipe.RecipeManager; +import com.github.yufiriamazenta.craftorithm.util.CollectionsUtil; +import com.github.yufiriamazenta.craftorithm.util.LangUtil; import crypticlib.CrypticLib; +import crypticlib.chat.MessageSender; import crypticlib.chat.TextProcessor; import crypticlib.config.ConfigWrapper; import crypticlib.conversation.Conversation; @@ -25,19 +29,20 @@ import org.jetbrains.annotations.Nullable; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.Map; public abstract class RecipeGroupEditor extends MultipageMenu { protected RecipeGroup recipeGroup; - protected Menu parent; + protected RecipeGroupListMenu parent; protected String title; protected int sortId; protected final Character ELEMENT_KEY = '%'; protected boolean inConversation = false; - protected RecipeGroupEditor(@NotNull Player player, @NotNull RecipeGroup recipeGroup, Menu parent) { + protected RecipeGroupEditor(@NotNull Player player, @NotNull RecipeGroup recipeGroup, RecipeGroupListMenu parent) { super(player); setElementKey(ELEMENT_KEY); Validate.notNull(recipeGroup); @@ -92,6 +97,22 @@ protected Icon getSortIdEditIcon(int slot) { ); } + protected Icon getRemoveIcon() { + return new Icon( + Material.BARRIER, + Languages.MENU_RECIPE_EDITOR_ICON_REMOVE_NAME.value(player), + event -> { + RecipeManager.INSTANCE.removeCraftorithmRecipe(recipeGroup().groupName(), true); + player.closeInventory(); + LangUtil.sendLang( + player, + Languages.MENU_RECIPE_EDITOR_ICON_REMOVE_MESSAGE, + CollectionsUtil.newStringHashMap("", recipeGroup.groupName()) + ); + } + ); + } + protected void updateSortIdEditIcon(ItemStack sortIdEditIconDisplay) { ItemUtil.setDisplayName( sortIdEditIconDisplay, @@ -113,7 +134,7 @@ public void onClose(InventoryCloseEvent event) { List typeWhenNotOpenInv = Arrays.asList(InventoryType.CRAFTING, InventoryType.CREATIVE); if (!typeWhenNotOpenInv.contains(type)) return; - parent.openMenu(); + parent.refreshRecipes().resetIcons().refreshInventory().openMenu(); } ); } @@ -123,7 +144,7 @@ public Menu parent() { return parent; } - public RecipeGroupEditor setParent(Menu parent) { + public RecipeGroupEditor setParent(RecipeGroupListMenu parent) { this.parent = parent; return this; } diff --git a/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/SmithingRecipeGroupEditor.java b/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/SmithingRecipeGroupEditor.java index 2cee825c..d51a4230 100644 --- a/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/SmithingRecipeGroupEditor.java +++ b/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/SmithingRecipeGroupEditor.java @@ -1,10 +1,10 @@ package com.github.yufiriamazenta.craftorithm.menu.editor; +import com.github.yufiriamazenta.craftorithm.menu.display.RecipeGroupListMenu; import com.github.yufiriamazenta.craftorithm.recipe.RecipeGroup; import crypticlib.ui.display.Icon; import crypticlib.ui.display.MenuDisplay; import crypticlib.ui.display.MenuLayout; -import crypticlib.ui.menu.Menu; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -14,7 +14,7 @@ public class SmithingRecipeGroupEditor extends UnlockableRecipeGroupEditor { - public SmithingRecipeGroupEditor(@NotNull Player player, @NotNull RecipeGroup recipeGroup, Menu parent) { + public SmithingRecipeGroupEditor(@NotNull Player player, @NotNull RecipeGroup recipeGroup, RecipeGroupListMenu parent) { super(player, recipeGroup, parent); setDisplay( new MenuDisplay( @@ -27,6 +27,7 @@ public SmithingRecipeGroupEditor(@NotNull Player player, @NotNull RecipeGroup re Map iconMap = new HashMap<>(); iconMap.put('A', getSortIdEditIcon(0)); iconMap.put('B', getUnlockIcon()); + iconMap.put('I', getRemoveIcon()); return iconMap; } ) diff --git a/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/StoneCuttingRecipeGroupEditor.java b/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/StoneCuttingRecipeGroupEditor.java index 0e948c39..5823f23b 100644 --- a/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/StoneCuttingRecipeGroupEditor.java +++ b/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/StoneCuttingRecipeGroupEditor.java @@ -1,10 +1,10 @@ package com.github.yufiriamazenta.craftorithm.menu.editor; +import com.github.yufiriamazenta.craftorithm.menu.display.RecipeGroupListMenu; import com.github.yufiriamazenta.craftorithm.recipe.RecipeGroup; import crypticlib.ui.display.Icon; import crypticlib.ui.display.MenuDisplay; import crypticlib.ui.display.MenuLayout; -import crypticlib.ui.menu.Menu; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -14,7 +14,7 @@ public class StoneCuttingRecipeGroupEditor extends UnlockableRecipeGroupEditor { - public StoneCuttingRecipeGroupEditor(@NotNull Player player, @NotNull RecipeGroup recipeGroup, Menu parent) { + public StoneCuttingRecipeGroupEditor(@NotNull Player player, @NotNull RecipeGroup recipeGroup, RecipeGroupListMenu parent) { super(player, recipeGroup, parent); setDisplay( new MenuDisplay( @@ -27,6 +27,7 @@ public StoneCuttingRecipeGroupEditor(@NotNull Player player, @NotNull RecipeGrou Map iconMap = new HashMap<>(); iconMap.put('A', getSortIdEditIcon(0)); iconMap.put('B', getUnlockIcon()); + iconMap.put('I', getRemoveIcon()); return iconMap; } ) diff --git a/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/UnlockableRecipeGroupEditor.java b/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/UnlockableRecipeGroupEditor.java index b69ab848..dcfa001b 100644 --- a/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/UnlockableRecipeGroupEditor.java +++ b/src/main/java/com/github/yufiriamazenta/craftorithm/menu/editor/UnlockableRecipeGroupEditor.java @@ -1,10 +1,10 @@ package com.github.yufiriamazenta.craftorithm.menu.editor; import com.github.yufiriamazenta.craftorithm.config.Languages; +import com.github.yufiriamazenta.craftorithm.menu.display.RecipeGroupListMenu; import com.github.yufiriamazenta.craftorithm.recipe.RecipeGroup; import com.github.yufiriamazenta.craftorithm.util.ItemUtils; import crypticlib.ui.display.Icon; -import crypticlib.ui.menu.Menu; import crypticlib.util.ItemUtil; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -15,7 +15,7 @@ public abstract class UnlockableRecipeGroupEditor extends RecipeGroupEditor { protected boolean unlock; - protected UnlockableRecipeGroupEditor(@NotNull Player player, @NotNull RecipeGroup recipeGroup, Menu parent) { + protected UnlockableRecipeGroupEditor(@NotNull Player player, @NotNull RecipeGroup recipeGroup, RecipeGroupListMenu parent) { super(player, recipeGroup, parent); this.unlock = recipeGroup.unlock(); } diff --git a/src/main/resources/lang/en_us.yml b/src/main/resources/lang/en_us.yml index 18981a26..3ee16146 100644 --- a/src/main/resources/lang/en_us.yml +++ b/src/main/resources/lang/en_us.yml @@ -139,6 +139,9 @@ menu: - '&aLeft click to modify cost level' - '&aRight click to toggle preserve item nbt' input_hint: '&aPlease enter cost level. Type "cancel" to cancel' + remove: + name: '&c&lClick to remove this recipe group' + message: ' &aRecipe removed successfully.' recipe_type_name: shaped: Shaped shapeless: Shapeless diff --git a/src/main/resources/lang/zh_cn.yml b/src/main/resources/lang/zh_cn.yml index 5bceb7d8..a52b6e28 100644 --- a/src/main/resources/lang/zh_cn.yml +++ b/src/main/resources/lang/zh_cn.yml @@ -138,6 +138,9 @@ menu: - '&a左键修改消耗等级' - '&a右键切换保留物品NBT' input_hint: '&a请输入新的消耗等级,输入“cancel”取消' + remove: + name: '&c&l点击删除此配方组' + message: ' &a配方删除成功' recipe_type_name: shaped: 有序 shapeless: 无序