diff options
| author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-30 15:26:11 +0100 |
|---|---|---|
| committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-30 15:26:11 +0100 |
| commit | 83951beb85032ca11eede16a11adb27ccc6042a4 (patch) | |
| tree | 1c507af5a23cac5d733d98e7ea68f23a806da495 /src/main/java/at/hannibal2/skyhanni/test | |
| parent | 248edea686fb2580a339b2ca0c3668f3f1da0ff7 (diff) | |
| download | skyhanni-83951beb85032ca11eede16a11adb27ccc6042a4.tar.gz skyhanni-83951beb85032ca11eede16a11adb27ccc6042a4.tar.bz2 skyhanni-83951beb85032ca11eede16a11adb27ccc6042a4.zip | |
Added debug command /shconfigmanagerreset
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/test')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt index 745cbcb97..d58c12a14 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt @@ -1,6 +1,8 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigGuiManager +import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.data.SlayerAPI @@ -20,6 +22,7 @@ import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzDebug import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.makeAccessible import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull @@ -98,6 +101,40 @@ class SkyHanniDebugsAndTests { // } } + fun configManagerResetCommand(args: Array<String>) { + if (args.size == 1 && args[0] == "confirm") { + configManagerReset() + return + } + + LorenzUtils.clickableChat( + "§cTHIS WILL RESET YOUR SkyHanni CONFIG! Click here to procceed.", + "shconfigmanagerreset confirm" + ) + } + + private fun configManagerReset() { + // TODO make it so that it does not reset the config + + // saving old config state + SkyHanniMod.configManager.saveConfig("reload config manager") + SkyHanniMod.configManager.saveSackData("reload config manager") + Thread { + Thread.sleep(500) + SkyHanniMod.configManager.disableSaving() + + // inizialising a new config manager, calling firstLoad, and setting it as the config manager in use. + val configManager = ConfigManager() + configManager.firstLoad() + SkyHanniMod.Companion::class.java.enclosingClass.getDeclaredField("configManager").makeAccessible() + .set(SkyHanniMod, configManager) + + // resetting the MoulConfigProcessor in use + ConfigGuiManager.editor = null + LorenzUtils.chat("§e[SkyHanni] Reseted the config manager!") + }.start() + } + fun testGardenVisitors() { if (displayList.isNotEmpty()) { displayList = mutableListOf() @@ -574,4 +611,4 @@ class SkyHanniDebugsAndTests { event.move(3, "dev.showNpcPrice", "dev.debug.showNpcPrice") } -}
\ No newline at end of file +} |
