diff options
author | Walker Selby <git@walkerselby.com> | 2023-10-15 12:50:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-15 13:50:14 +0200 |
commit | 0bdfaab9e486f0c6adc576e3a939838ef1827c80 (patch) | |
tree | 9bb2f1bd50b62590220440b94f2cad0fda7f9e9b /src/main/java/at/hannibal2/skyhanni/test | |
parent | 202759b6752741e32c3b2d3e022ea8d71400188f (diff) | |
download | skyhanni-0bdfaab9e486f0c6adc576e3a939838ef1827c80.tar.gz skyhanni-0bdfaab9e486f0c6adc576e3a939838ef1827c80.tar.bz2 skyhanni-0bdfaab9e486f0c6adc576e3a939838ef1827c80.zip |
Internal Change: Config deprecations (#542)
migrate the config, removed id system entirely #542
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/test')
7 files changed, 62 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/CommandsSendToServerLogger.kt b/src/main/java/at/hannibal2/skyhanni/test/CommandsSendToServerLogger.kt index d7403c626..25d876f7a 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/CommandsSendToServerLogger.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/CommandsSendToServerLogger.kt @@ -1,13 +1,20 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CommandsSendToServerLogger { companion object { fun logCommandsToServer(command: String) { - if (SkyHanniMod.feature.dev.commandLogs) { + if (SkyHanniMod.feature.dev.debug.commandLogs) { Exception("command send to server: '$command'").printStackTrace() } } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(3, "dev.commandLogs", "dev.debug.commandLogs") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/test/HighlightMissingRepoItems.kt b/src/main/java/at/hannibal2/skyhanni/test/HighlightMissingRepoItems.kt index cafb99635..06983d328 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/HighlightMissingRepoItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/HighlightMissingRepoItems.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull @@ -22,7 +23,7 @@ class HighlightMissingRepoItems { @SubscribeEvent(priority = EventPriority.LOWEST) fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { if (!LorenzUtils.inSkyBlock) return - if (!SkyHanniMod.feature.dev.highlightMissingRepo) return + if (!SkyHanniMod.feature.dev.debug.highlightMissingRepo) return val gui = event.gui @@ -56,4 +57,9 @@ class HighlightMissingRepoItems { ignoreItems.load(it.asJsonObject) } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(3, "dev.highlightMissingRepo", "dev.debug.highlightMissingRepo") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/test/ShowItemUuid.kt b/src/main/java/at/hannibal2/skyhanni/test/ShowItemUuid.kt index 511c26119..8665d99b3 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/ShowItemUuid.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/ShowItemUuid.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getItemUuid import net.minecraftforge.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -9,7 +10,7 @@ class ShowItemUuid { @SubscribeEvent fun onItemTooltipLow(event: ItemTooltipEvent) { - if (!SkyHanniMod.feature.dev.showItemUuid) return + if (!SkyHanniMod.feature.dev.debug.showItemUuid) return val itemStack = event.itemStack if (itemStack != null) { itemStack.getItemUuid()?.let { @@ -17,4 +18,9 @@ class ShowItemUuid { } } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(3, "dev.showItemUuid", "dev.debug.showItemUuid") + } } diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt index 4a5540c21..110c4ce28 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.data.SlayerAPI import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -40,6 +41,7 @@ class SkyHanniDebugsAndTests { companion object { private val config get() = SkyHanniMod.feature.dev + private val debugConfig get() = config.debug var displayLine = "" var displayList = emptyList<List<Any>>() @@ -289,7 +291,7 @@ class SkyHanniDebugsAndTests { @SubscribeEvent fun onKeybind(event: GuiScreenEvent.KeyboardInputEvent.Post) { - if (!SkyHanniMod.feature.dev.copyInternalName.isKeyHeld()) return + if (!debugConfig.copyInternalName.isKeyHeld()) return val gui = event.gui as? GuiContainer ?: return val focussedSlot = gui.slotUnderMouse ?: return val stack = focussedSlot.stack ?: return @@ -302,10 +304,10 @@ class SkyHanniDebugsAndTests { @SubscribeEvent fun onShowInternalName(event: ItemTooltipEvent) { if (!LorenzUtils.inSkyBlock) return - if (!config.showInternalName) return + if (!debugConfig.showInternalName) return val itemStack = event.itemStack ?: return val internalName = itemStack.getInternalName() - if ((internalName == NEUInternalName.NONE) && !config.showEmptyNames) return + if ((internalName == NEUInternalName.NONE) && !debugConfig.showEmptyNames) return event.toolTip.add("Internal Name: '${internalName.asString()}'") } @@ -313,7 +315,7 @@ class SkyHanniDebugsAndTests { @SubscribeEvent fun showItemRarity(event: ItemTooltipEvent) { if (!LorenzUtils.inSkyBlock) return - if (!config.showItemRarity) return + if (!debugConfig.showItemRarity) return val itemStack = event.itemStack ?: return val rarity = itemStack.getItemRarityOrNull(logError = false) @@ -323,7 +325,7 @@ class SkyHanniDebugsAndTests { @SubscribeEvent fun onSHowNpcPrice(event: ItemTooltipEvent) { if (!LorenzUtils.inSkyBlock) return - if (!config.showNpcPrice) return + if (!debugConfig.showNpcPrice) return val itemStack = event.itemStack ?: return val internalName = itemStack.getInternalNameOrNull() ?: return @@ -349,7 +351,7 @@ class SkyHanniDebugsAndTests { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!LorenzUtils.inSkyBlock) return - if (!config.debugEnabled) return + if (!debugConfig.enabled) return if (displayLine.isNotEmpty()) { config.debugPos.renderString("test: $displayLine", posLabel = "Test") @@ -561,4 +563,15 @@ class SkyHanniDebugsAndTests { // println("particleSpeed: $particleSpeed") // println("offset: $offset") } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(3, "dev.debugEnabled", "dev.debug.enabled") + event.move(3, "dev.showInternalName", "dev.debug.showInternalName") + event.move(3, "dev.showEmptyNames", "dev.debug.showEmptyNames") + event.move(3, "dev.showItemRarity", "dev.debug.showItemRarity") + event.move(3,"dev.copyInternalName", "dev.debug.copyInternalName") + event.move(3, "dev.showNpcPrice", "dev.debug.showNpcPrice") + + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt b/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt index 993778afc..3e5072fac 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.InventoryUpdatedEvent import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.getSkullOwner @@ -43,7 +44,7 @@ object TestCopyBestiaryValues { @SubscribeEvent(priority = EventPriority.LOW) fun onLateInventoryOpen(event: InventoryUpdatedEvent) { - if (!SkyHanniMod.feature.dev.copyBestiaryData) return + if (!SkyHanniMod.feature.dev.debug.copyBestiaryData) return SkyHanniDebugsAndTests.displayLine = "" val backItem = event.inventoryItems[3 + 9 * 5 + 3] @@ -110,4 +111,9 @@ object TestCopyBestiaryValues { SkyHanniDebugsAndTests.displayLine = "Bestiary for $titleName" } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(3, "dev.copyBestiaryData", "dev.debug.copyBestiaryData") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt b/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt index a556a7254..be659b25d 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigManager +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -16,7 +17,7 @@ object TestCopyRngMeterValues { @SubscribeEvent fun onInventoryOpen(event: InventoryFullyOpenedEvent) { - if (!SkyHanniMod.feature.dev.copyRngMeter) return + if (!SkyHanniMod.feature.dev.debug.copyRngMeter) return val map = mutableMapOf<NEUInternalName, Long>() val slayerPattern = "§7Slayer XP: §d.*§5/§d(?<xp>.*)".toPattern() @@ -36,4 +37,9 @@ object TestCopyRngMeterValues { OSUtils.copyToClipboard(ConfigManager.gson.toJson(map)) LorenzUtils.debug("${map.size} items saved to clipboard.") } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(3, "dev.copyRngMeter", "dev.debug.copyRngMeter") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt b/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt index 426562e6f..95399fb1e 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.utils.ItemStackTypeAdapterFactory import at.hannibal2.skyhanni.utils.KSerializable import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld @@ -48,7 +49,7 @@ object TestExportTools { @SubscribeEvent fun onKeybind(event: GuiScreenEvent.KeyboardInputEvent.Post) { - if (!SkyHanniMod.feature.dev.copyNBTDataCompressed.isKeyHeld()) return + if (!SkyHanniMod.feature.dev.debug.copyNBTDataCompressed.isKeyHeld()) return val gui = event.gui as? GuiContainer ?: return val focussedSlot = gui.slotUnderMouse ?: return val stack = focussedSlot.stack ?: return @@ -62,4 +63,9 @@ object TestExportTools { val reader = InputStreamReader(javaClass.getResourceAsStream("/testdata/${category.name}/$name.json")!!) return fromJson(category, reader) } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(3, "dev.copyNBTDataCompressed", "dev.debug.copyNBTDataCompressed") + } }
\ No newline at end of file |