blob: 2aad75a40e3ef2ef48acee8989501c2a2d47f729 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package at.hannibal2.skyhanni.config
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.GuiEditManager
import io.github.notenoughupdates.moulconfig.gui.GuiScreenElementWrapper
import io.github.notenoughupdates.moulconfig.gui.MoulConfigEditor
object ConfigGuiManager {
var editor: MoulConfigEditor<Features>? = null
fun getEditorInstance() = editor ?: MoulConfigEditor(SkyHanniMod.configManager.processor).also { editor = it }
fun openConfigGui(search: String? = null) {
val editor = getEditorInstance()
if (search != null) {
editor.search(search)
}
SkyHanniMod.screenToOpen = GuiScreenElementWrapper(editor)
}
fun onCommand(args: Array<String>) {
if (args.isNotEmpty()) {
if (args[0].lowercase() == "gui") {
GuiEditManager.openGuiPositionEditor(hotkeyReminder = true)
} else {
openConfigGui(args.joinToString(" "))
}
} else {
openConfigGui()
}
}
}
|