diff options
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt | 2 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt | 31 |
2 files changed, 31 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt index e73f63813..f9a94e1d0 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 = 18 + const val CONFIG_VERSION = 19 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/features/bingo/MinionCraftHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt index bfcb24501..e3fe529fc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.bingo import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -18,6 +19,8 @@ import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import com.google.gson.JsonArray +import com.google.gson.JsonObject import io.github.moulberry.notenoughupdates.recipes.CraftingRecipe import net.minecraft.client.Minecraft import net.minecraft.item.ItemStack @@ -117,7 +120,7 @@ class MinionCraftHelper { } } - FirstMinionTier.firstMinionTier(otherItems, minions, tierOneMinions, tierOneMinionsDone) + FirstMinionTier.firstMinionTier(otherItems, minions, tierOneMinions, tierOneMinionsDone) return Pair(minions, otherItems) } @@ -265,4 +268,30 @@ class MinionCraftHelper { } } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.transform(19, "#player.bingoSessions") { element -> + for ((_, data) in element.asJsonObject.entrySet()) { + fixTierOneMinions(data.asJsonObject) + } + element + } + } + + private fun fixTierOneMinions(data: JsonObject) { + val newList = JsonArray() + var i = 0 + for (entry in data["tierOneMinionsDone"].asJsonArray) { + val name = entry.asString + if (!name.startsWith("INTERNALNAME:")) { + newList.add(entry) + } else { + i++ + } + } + println("fixTierOneMinions: removed $i wrong entries.") + data.add("tierOneMinionsDone", newList) + } + } |