mirror of
https://github.com/Auxilor/EcoMenus.git
synced 2025-12-19 15:09:20 +00:00
Many fixes
This commit is contained in:
@@ -28,7 +28,7 @@ class ConfigurableSlot(
|
||||
override val column: Int = config.getInt("location.column")
|
||||
val page: Int = config.getInt("location.page")
|
||||
|
||||
override val layer = runCatching { enumValueOf<MenuLayer>(config.getString("layer")) }
|
||||
override val layer = runCatching { enumValueOf<MenuLayer>(config.getString("location.layer").uppercase()) }
|
||||
.getOrElse { MenuLayer.MIDDLE }
|
||||
|
||||
private val context = baseContext.with("slot at row ${row}, column $column, page $page")
|
||||
@@ -84,13 +84,11 @@ class ConfigurableSlot(
|
||||
return slot
|
||||
}
|
||||
|
||||
fun <T : PageBuilder> add(builder: T): T {
|
||||
fun add(builder: PageBuilder) {
|
||||
try {
|
||||
builder.addComponent(this)
|
||||
} catch (e: Exception) {
|
||||
context.log(ConfigViolation("location", "Invalid location!"))
|
||||
}
|
||||
|
||||
return builder
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ fun buildMenu(plugin: EcoPlugin, menu: EcoMenu, config: Config): Menu {
|
||||
|
||||
val slots = mutableListOf<ConfigurableSlot>()
|
||||
|
||||
for (slotConfig in config.getSubsections("slot_templates")) {
|
||||
for (slotConfig in config.getSubsections("slots")) {
|
||||
val slot = ConfigurableSlot(
|
||||
plugin,
|
||||
ViolationContext(plugin, "menu ${menu.id}"),
|
||||
@@ -93,7 +93,7 @@ fun buildMenu(plugin: EcoPlugin, menu: EcoMenu, config: Config): Menu {
|
||||
|
||||
onClose { event, menu ->
|
||||
val player = event.player as Player
|
||||
menu.close(player)
|
||||
menu.previousMenus[player].popOrNull()?.open(player)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
#Sat Jun 03 15:45:10 BST 2023
|
||||
kotlin.code.style=official
|
||||
libreforge-version=4.17.2
|
||||
version=1.0.0
|
||||
version=0.0.1-ALPHA
|
||||
Reference in New Issue
Block a user