From ceba1bcd27be407b5deb880ced5055ff1dcaffe5 Mon Sep 17 00:00:00 2001 From: Exanthiax <107284021+Exanthiax@users.noreply.github.com> Date: Sat, 13 Jun 2026 22:03:02 +0100 Subject: [PATCH] feat: improve pages and refactor code --- documentation/ecoenchants/plugin-config.md | 10 +++++++++- .../willfp/ecoenchants/enchant/EnchantGUI.kt | 20 ++++++++++--------- .../core-plugin/src/main/resources/config.yml | 10 +++++++++- gradle.properties | 4 ++-- 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/documentation/ecoenchants/plugin-config.md b/documentation/ecoenchants/plugin-config.md index 556f4845b1..aa81afe317 100644 --- a/documentation/ecoenchants/plugin-config.md +++ b/documentation/ecoenchants/plugin-config.md @@ -125,7 +125,7 @@ enchantinfo: # Options for the enchant GUI. enchant-gui: rows: 6 # How many rows to have in the GUI - title: "Enchant GUI" # The title of the GUI + title: "Enchant GUI &7(%page%/%max_page%)" # The title of the GUI mask: # The background material items: @@ -157,12 +157,20 @@ enchant-gui: # Options for the page change buttons page-change: + # The sound played when the page is changed + sound: + enabled: true + sound: ui.button.click + pitch: 1.0 + volume: 1.0 forwards: item: arrow name:"&fNext Page" # The item. Will not show if on the last page. + item-inactive: gray_dye name:"&7Next Page" # The item shown on the last page row: 6 column: 6 backwards: item: arrow name:"&fPrevious Page" # The item. Will not show if on the first page. + item-inactive: gray_dye name:"&7Previous Page" # The item shown on the first page row: 6 column: 4 diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/EnchantGUI.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/EnchantGUI.kt index 795e9ad523..f67874a191 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/EnchantGUI.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/EnchantGUI.kt @@ -5,9 +5,9 @@ import com.willfp.eco.core.config.base.LangYml import com.willfp.eco.core.drops.DropQueue import com.willfp.eco.core.fast.fast import com.willfp.eco.core.gui.GUIComponent +import com.willfp.eco.core.gui.addPageChanger import com.willfp.eco.core.gui.menu import com.willfp.eco.core.gui.menu.Menu -import com.willfp.eco.core.gui.menu.MenuLayer import com.willfp.eco.core.gui.page.Page import com.willfp.eco.core.gui.page.PageChanger import com.willfp.eco.core.gui.slot @@ -19,6 +19,7 @@ import com.willfp.eco.core.items.Items import com.willfp.eco.core.items.builder.EnchantedBookBuilder import com.willfp.eco.core.items.builder.ItemStackBuilder import com.willfp.eco.core.items.isEcoEmpty +import com.willfp.eco.core.sound.PlayableSound import com.willfp.eco.util.formatEco import com.willfp.eco.util.lineWrap import com.willfp.ecoenchants.display.EnchantSorter.sortForDisplay @@ -141,17 +142,18 @@ object EnchantGUI { pane ) + val pageChangeSound = PlayableSound.create( + plugin.configYml.getSubsection("enchant-gui.page-change.sound") + ) + for (direction in PageChanger.Direction.entries) { val directionName = direction.name.lowercase() - addComponent( - MenuLayer.TOP, - plugin.configYml.getInt("enchant-gui.page-change.$directionName.row"), - plugin.configYml.getInt("enchant-gui.page-change.$directionName.column"), - PageChanger( - Items.lookup(plugin.configYml.getString("enchant-gui.page-change.$directionName.item")).item, - direction - ) + addPageChanger( + plugin.configYml, + "enchant-gui.page-change.$directionName", + direction, + pageChangeSound ) } diff --git a/eco-core/core-plugin/src/main/resources/config.yml b/eco-core/core-plugin/src/main/resources/config.yml index 1643666159..bdfe61bb82 100644 --- a/eco-core/core-plugin/src/main/resources/config.yml +++ b/eco-core/core-plugin/src/main/resources/config.yml @@ -114,7 +114,7 @@ enchantinfo: # Options for the enchant GUI. enchant-gui: rows: 6 # How many rows to have in the GUI - title: "Enchant GUI" # The title of the GUI + title: "Enchant GUI &7(%page%/%max_page%)" # The title of the GUI mask: # The background material items: @@ -146,12 +146,20 @@ enchant-gui: # Options for the page change buttons page-change: + # The sound played when the page is changed + sound: + enabled: true + sound: ui.button.click + pitch: 1.0 + volume: 1.0 forwards: item: arrow name:"&fNext Page" # The item. Will not show if on the last page. + item-inactive: gray_dye name:"&7Next Page" # The item shown on the last page row: 6 column: 6 backwards: item: arrow name:"&fPrevious Page" # The item. Will not show if on the first page. + item-inactive: gray_dye name:"&7Previous Page" # The item shown on the first page row: 6 column: 4 diff --git a/gradle.properties b/gradle.properties index d6645a838b..ce8c7621f0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ #libreforge-updater #Wed Jun 10 19:44:44 BST 2026 -eco-version=7.6.0 +eco-version=2026.24 kotlin.code.style=official kotlin.daemon.jvmargs=-Xmx2g -XX\:+UseG1GC -XX\:MaxMetaspaceSize\=512m -libreforge-version=5.7.0 +libreforge-version=2026.24 org.gradle.parallel=true version=2026.24