diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-25 01:00:26 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-25 01:00:26 +0100 |
commit | e70531a2090979d942b047be004b319869a6f220 (patch) | |
tree | 9c07adc33c159b321b871cba779b7f08f111f9e9 /src/main/java/at/hannibal2 | |
parent | 2f0c352849ec84e53676f62be27a1c9e92210441 (diff) | |
download | skyhanni-e70531a2090979d942b047be004b319869a6f220.tar.gz skyhanni-e70531a2090979d942b047be004b319869a6f220.tar.bz2 skyhanni-e70531a2090979d942b047be004b319869a6f220.zip |
Fixed config migration errors
Diffstat (limited to 'src/main/java/at/hannibal2')
11 files changed, 29 insertions, 26 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 079565b39..7db58d21f 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -169,6 +169,7 @@ import at.hannibal2.skyhanni.features.garden.farming.CropMoneyDisplay import at.hannibal2.skyhanni.features.garden.farming.CropSpeedMeter import at.hannibal2.skyhanni.features.garden.farming.DicerRngDropTracker import at.hannibal2.skyhanni.features.garden.farming.FarmingWeightDisplay +import at.hannibal2.skyhanni.features.garden.farming.GardenBestCropTime import at.hannibal2.skyhanni.features.garden.farming.GardenBurrowingSporesNotifier import at.hannibal2.skyhanni.features.garden.farming.GardenCropMilestoneDisplay import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed @@ -416,6 +417,7 @@ class SkyHanniMod { loadModule(AdvancedPlayerList) loadModule(ItemAddManager()) loadModule(BingoCardReader()) + loadModule(GardenBestCropTime()) loadModule(TrackerManager) // APIs diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt index 581bf0f3a..f98373ea3 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt @@ -9,7 +9,7 @@ import com.google.gson.JsonPrimitive object ConfigUpdaterMigrator { val logger = LorenzLogger("ConfigMigration") - const val CONFIG_VERSION = 16 + const val CONFIG_VERSION = 17 fun JsonElement.at(chain: List<String>, init: Boolean): JsonElement? { if (chain.isEmpty()) return this if (this !is JsonObject) return null diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/rift/motes/MotesConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/rift/motes/MotesConfig.java index 2a65a6652..ef6c3a3e7 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/rift/motes/MotesConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/rift/motes/MotesConfig.java @@ -23,5 +23,5 @@ public class MotesConfig { @Expose @ConfigOption(name = "Inventory Value", desc = "") @Accordion - public InventoryValueConfig inventoryValue = new InventoryValueConfig(); + public RiftInventoryValueConfig inventoryValue = new RiftInventoryValueConfig(); } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/rift/motes/InventoryValueConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/rift/motes/RiftInventoryValueConfig.java index 50ec181e4..4b4fef21d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/rift/motes/InventoryValueConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/rift/motes/RiftInventoryValueConfig.java @@ -8,7 +8,7 @@ import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; import io.github.moulberry.moulconfig.annotations.ConfigOption; -public class InventoryValueConfig { +public class RiftInventoryValueConfig { @Expose @ConfigOption(name = "Inventory Value", desc = "Show total Motes NPC price for the current opened inventory.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt b/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt index 9a57f87cc..305088949 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt @@ -1,9 +1,12 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.chroma.ChromaConfig import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.features.misc.visualwords.VisualWordGui import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests +import at.hannibal2.skyhanni.utils.ConfigUtils import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.client.gui.inventory.GuiInventory @@ -48,4 +51,12 @@ class RenderData { if (!SkyHanniDebugsAndTests.globalRender) return LorenzRenderWorldEvent(event.partialTicks).postAndCatch() } + + // TODO find better spot for this + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.transform(17, "chroma.chromaDirection") { element -> + ConfigUtils.migrateIntToEnum(element, ChromaConfig.Direction::class.java) + } + } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt b/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt index de9caa02e..cea3a5c2f 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt @@ -1,8 +1,11 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.misc.TrackerConfig.PriceFromEntry import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -34,4 +37,11 @@ object TrackerManager { hasChanged = false } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.transform(17, "misc.tracker.priceFrom") { element -> + ConfigUtils.migrateIntToEnum(element, PriceFromEntry::class.java) + } + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt b/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt index e265d6525..902caadf0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt @@ -1,15 +1,12 @@ package at.hannibal2.skyhanni.features.chroma import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.chroma.ChromaConfig.Direction import at.hannibal2.skyhanni.data.MinecraftData import at.hannibal2.skyhanni.mixins.transformers.AccessorMinecraft -import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.shader.Shader import at.hannibal2.skyhanni.utils.shader.Uniform import net.minecraft.client.Minecraft -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent /** * Modified from SkyblockAddons @@ -50,11 +47,4 @@ object ChromaShader : Shader("chroma", "chroma") { } } } - - @SubscribeEvent - fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { - event.transform(15, "config.chromaDirection") { element -> - ConfigUtils.migrateIntToEnum(element, Direction::class.java) - } - } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt index 32dfd7759..4e820c245 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt @@ -140,7 +140,7 @@ class GardenBestCropTime { event.move(3, "garden.cropMilestoneBestCompact", "garden.cropMilestones.next.bestCompact") event.move(3, "garden.cropMilestoneBestHideTitle", "garden.cropMilestones.next.bestHideTitle") - event.transform(15, "garden.cropMilestones.next.bestType") { element -> + event.transform(17, "garden.cropMilestones.next.bestType") { element -> ConfigUtils.migrateIntToEnum(element, BestTypeEntry::class.java) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt index ca3ab6f21..f8b536bf4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt @@ -292,7 +292,7 @@ class ChestValue { @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { - event.transform(15, "inventory.chestValueConfig.numberFormat") { element -> + event.transform(17, "inventory.chestValueConfig.formatType") { element -> ConfigUtils.migrateIntToEnum(element, NumberFormatEntry::class.java) } event.transform(15, "inventory.chestValueConfig.sortingType") { element -> diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt index caca2b283..38077a538 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.features.rift.everywhere.motes import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator -import at.hannibal2.skyhanni.config.features.rift.motes.InventoryValueConfig.NumberFormatEntry +import at.hannibal2.skyhanni.config.features.rift.motes.RiftInventoryValueConfig.NumberFormatEntry import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt index 234902c10..4a78641ef 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt @@ -1,7 +1,6 @@ package at.hannibal2.skyhanni.utils.tracker import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.Storage import at.hannibal2.skyhanni.config.core.config.Position import at.hannibal2.skyhanni.config.features.misc.TrackerConfig.PriceFromEntry @@ -9,7 +8,6 @@ import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.data.TrackerManager import at.hannibal2.skyhanni.features.bazaar.BazaarApi.Companion.getBazaarData import at.hannibal2.skyhanni.features.misc.items.EstimatedItemValue -import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.NEUInternalName @@ -20,7 +18,6 @@ import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.renderables.Renderable import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiInventory -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds open class SkyHanniTracker<Data : TrackerData>( @@ -191,11 +188,4 @@ open class SkyHanniTracker<Data : TrackerData>( override fun toString() = display } - - @SubscribeEvent - fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { - event.transform(15, "misc.tracker.priceFrom") { element -> - ConfigUtils.migrateIntToEnum(element, PriceFromEntry::class.java) - } - } } |