Skip to content

Commit 932971b

Browse files
committed
cleanup
Signed-off-by: illyrius666 <[email protected]>
1 parent 2ba8831 commit 932971b

2 files changed

Lines changed: 11 additions & 39 deletions

File tree

IllyriaKingdoms/src/guis/MainGui.kt

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package org.xodium.illyriaplus.guis
22

3-
// import org.xodium.illyriaplus.pdcs.PlayerPDC.kingdom
3+
import io.papermc.paper.datacomponent.DataComponentTypes
44
import org.bukkit.Material
55
import org.bukkit.entity.Player
66
import org.bukkit.inventory.ItemStack
77
import org.xodium.illyriaplus.data.KingdomData
8-
import org.xodium.illyriaplus.interfaces.GuiInterface
98
import org.xodium.illyriaplus.utils.Utils.MM
109
import xyz.xenondevs.invui.gui.Gui
1110
import xyz.xenondevs.invui.item.Item
@@ -14,8 +13,9 @@ import xyz.xenondevs.invui.window.Window
1413
import kotlin.uuid.ExperimentalUuidApi
1514

1615
/** A demo GUI showing a basic InvUI setup with a clickable dragon breath item. */
16+
@Suppress("UnstableApiUsage")
1717
@OptIn(ExperimentalUuidApi::class)
18-
internal object MainGui : GuiInterface {
18+
internal object MainGui {
1919
/** The clickable item displayed in the GUI that prints "TEST" when clicked. */
2020
private val FILLER_ITEM =
2121
Item
@@ -24,11 +24,14 @@ internal object MainGui : GuiInterface {
2424
.build()
2525

2626
/** The item that triggers rename functionality when clicked in the GUI. */
27-
private fun createRenameItem(kingdom: KingdomData) =
27+
private fun renameItem(kingdom: KingdomData) =
2828
Item
2929
.builder()
30-
.setItemProvider(ItemStack.of(Material.NAME_TAG))
31-
.addClickHandler { _, click ->
30+
.setItemProvider(
31+
ItemStack.of(Material.NAME_TAG).apply {
32+
setData(DataComponentTypes.ITEM_NAME, MM.deserialize("Rename Kingdom"))
33+
},
34+
).addClickHandler { _, click ->
3235
AnvilWindow
3336
.builder()
3437
.setTitle(MM.deserialize("Enter New Kingdom Name"))
@@ -37,16 +40,8 @@ internal object MainGui : GuiInterface {
3740
.open(click.player)
3841
}.build()
3942

40-
/** Placeholder GUI - actual GUI is built dynamically in window(). */
41-
override val gui: Gui =
42-
Gui
43-
.builder()
44-
.setStructure("# # # # # # # # #")
45-
.addIngredient('#', FILLER_ITEM)
46-
.build()
47-
4843
/** Creates a window for the given player with their kingdom name as the title. */
49-
override fun window(
44+
fun window(
5045
player: Player,
5146
kingdom: KingdomData,
5247
): Window {
@@ -55,7 +50,7 @@ internal object MainGui : GuiInterface {
5550
.builder()
5651
.setStructure("# # # # # # R # #")
5752
.addIngredient('#', FILLER_ITEM)
58-
.addIngredient('R', createRenameItem(kingdom))
53+
.addIngredient('R', renameItem(kingdom))
5954
.build()
6055

6156
return Window

IllyriaKingdoms/src/interfaces/GuiInterface.kt

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)