diff options
| author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-05 12:40:57 +0100 |
|---|---|---|
| committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-05 12:40:57 +0100 |
| commit | 7721be72deb7acb5e3f133482a51e1286f875c47 (patch) | |
| tree | 031c121d46a3fa085046ff4396b377a3f6d42bd1 /src/main/java/at/hannibal2/skyhanni/data | |
| parent | 5f6cbe465b0914ac006bb7eac6975205ad4fb29a (diff) | |
| download | skyhanni-7721be72deb7acb5e3f133482a51e1286f875c47.tar.gz skyhanni-7721be72deb7acb5e3f133482a51e1286f875c47.tar.bz2 skyhanni-7721be72deb7acb5e3f133482a51e1286f875c47.zip | |
Resetting parts of the inventory for users with 7-month-old SkyHanni versions that want to migrate into the present.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt | 77 |
1 files changed, 1 insertions, 76 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt index 63f77f2d2..d14372419 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt @@ -12,7 +12,6 @@ import at.hannibal2.skyhanni.events.PreProfileSwitchEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -115,7 +114,6 @@ object ProfileStorageData { noTabListTime = -1 profileSpecific = playerSpecific.profiles.getOrPut(profileName) { Storage.ProfileSpecific() } sackProfiles = sackProfile.profiles.getOrPut(profileName) { SackData.ProfileSpecific() } - tryMigrateProfileSpecific() loaded = true ConfigLoadEvent().postAndCatch() } @@ -125,79 +123,6 @@ object ProfileStorageData { val playerUuid = LorenzUtils.getRawPlayerUuid() playerSpecific = SkyHanniMod.feature.storage.players.getOrPut(playerUuid) { Storage.PlayerSpecific() } sackPlayers = SkyHanniMod.sackData.players.getOrPut(playerUuid) { SackData.PlayerSpecific() } - migratePlayerSpecific() ConfigLoadEvent().postAndCatch() } - - private fun migratePlayerSpecific() { - val oldHidden = SkyHanniMod.feature.hidden - if (oldHidden.isMigrated) return - - SkyHanniMod.feature.storage?.let { - it.gardenJacobFarmingContestTimes = oldHidden.gardenJacobFarmingContestTimes - } - } - - private fun tryMigrateProfileSpecific() { - val oldHidden = SkyHanniMod.feature.hidden - if (oldHidden.isMigrated) return - - profileSpecific?.let { - it.currentPet = oldHidden.currentPet - - for ((rawLocation, minionName) in oldHidden.minionName) { - val lastClick = oldHidden.minionLastClick[rawLocation] ?: -1 - val location = LorenzVec.decodeFromString(rawLocation) - val minionConfig = Storage.ProfileSpecific.MinionConfig() - minionConfig.displayName = minionName - minionConfig.lastClicked = lastClick - it.minions[location] = minionConfig - } - } - - profileSpecific?.crimsonIsle?.let { - it.quests = oldHidden.crimsonIsleQuests - it.miniBossesDoneToday = oldHidden.crimsonIsleMiniBossesDoneToday - it.kuudraTiersDone = oldHidden.crimsonIsleKuudraTiersDone - } - - profileSpecific?.garden?.let { - it.experience = oldHidden.gardenExp.toLong() - it.cropCounter = oldHidden.gardenCropCounter - it.cropUpgrades = oldHidden.gardenCropUpgrades - - for ((crop, speed) in oldHidden.gardenCropsPerSecond) { - if (speed != -1) { - it.cropsPerSecond[crop] = speed - } - } - - it.latestBlocksPerSecond = oldHidden.gardenLatestBlocksPerSecond - it.latestTrueFarmingFortune = oldHidden.gardenLatestTrueFarmingFortune - it.savedCropAccessory = oldHidden.savedCropAccessory - it.dicerRngDrops = oldHidden.gardenDicerRngDrops - it.informedAboutLowMatter = oldHidden.informedAboutLowMatter - it.informedAboutLowFuel = oldHidden.informedAboutLowFuel - it.visitorInterval = oldHidden.visitorInterval - it.nextSixthVisitorArrival = oldHidden.nextSixthVisitorArrival - it.farmArmorDrops = oldHidden.gardenFarmingArmorDrops - it.composterUpgrades = oldHidden.gardenComposterUpgrades - it.toolWithBountiful = oldHidden.gardenToolHasBountiful - it.composterCurrentOrganicMatterItem = oldHidden.gardenComposterCurrentOrganicMatterItem - it.composterCurrentFuelItem = oldHidden.gardenComposterCurrentFuelItem - } - - profileSpecific?.garden?.visitorDrops?.let { - val old = oldHidden.visitorDrops - it.acceptedVisitors = old.acceptedVisitors - it.deniedVisitors = old.deniedVisitors - it.visitorRarities = old.visitorRarities - it.copper = old.copper - it.farmingExp = old.farmingExp - it.coinsSpent = old.coinsSpent - it.rewardsCount = old.rewardsCount - } - - oldHidden.isMigrated = true - } -}
\ No newline at end of file +} |
