aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-01 21:10:48 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-01 21:10:48 +0100
commit5c6ac5e309019f8216f5f020c82888d224cee3f9 (patch)
tree047e4f49bcd1cfefa010d40640473f0c1455832b /src/main/java/at
parent11191c5d95f901504f0165bbada5b841c47b680d (diff)
downloadskyhanni-5c6ac5e309019f8216f5f020c82888d224cee3f9.tar.gz
skyhanni-5c6ac5e309019f8216f5f020c82888d224cee3f9.tar.bz2
skyhanni-5c6ac5e309019f8216f5f020c82888d224cee3f9.zip
Made the esc -> mod options -> SkyHanni -> config button not crash you.
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt7
2 files changed, 5 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt
index a8190ca5b..94f609c6e 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt
@@ -18,7 +18,7 @@ class ConfigGuiForgeInterop : IModGuiFactory {
override fun getHandlerFor(element: RuntimeOptionCategoryElement): RuntimeOptionGuiHandler? = null
- class WrappedSkyHanniConfig(private val parent: GuiScreen) : GuiScreenElementWrapper(ConfigGuiManager.editor) {
+ class WrappedSkyHanniConfig(private val parent: GuiScreen) : GuiScreenElementWrapper(ConfigGuiManager.getEditorInstance()) {
@Throws(IOException::class)
override fun handleKeyboardInput() {
if (Keyboard.getEventKeyState() && Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
@@ -28,4 +28,4 @@ class ConfigGuiForgeInterop : IModGuiFactory {
super.handleKeyboardInput()
}
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt
index 9708c513b..f6bcd3bbc 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt
@@ -8,11 +8,10 @@ object ConfigGuiManager {
var editor: MoulConfigEditor<Features>? = null
+ fun getEditorInstance() = editor ?: MoulConfigEditor(SkyHanniMod.configManager.processor).also { editor = it }
+
fun openConfigGui(search: String? = null) {
- if (editor == null) {
- editor = MoulConfigEditor(SkyHanniMod.configManager.processor)
- }
- val editor = editor ?: return
+ val editor = getEditorInstance()
if (search != null) {
editor.search(search)