diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-16 13:20:59 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-16 13:20:59 +0200 |
commit | b155103abb08a9d54d91cc1d141bce8994f69a89 (patch) | |
tree | a7510777c4c4c51acdeacd1b3f0b48079f1f3e71 /src/main/java/at/hannibal2/skyhanni | |
parent | 83b5cd3c93bab32f16365c6b6810362f4de5598e (diff) | |
download | skyhanni-b155103abb08a9d54d91cc1d141bce8994f69a89.tar.gz skyhanni-b155103abb08a9d54d91cc1d141bce8994f69a89.tar.bz2 skyhanni-b155103abb08a9d54d91cc1d141bce8994f69a89.zip |
use config migration on ashfang gravity orbs
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
4 files changed, 35 insertions, 14 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt index 6b590a389..b0446f62e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt @@ -8,7 +8,7 @@ import com.google.gson.JsonPrimitive object ConfigUpdaterMigrator { val logger = LorenzLogger("ConfigMigration") - val configVersion = 0 + val configVersion = 1 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/AshfangConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/AshfangConfig.java index 9cffc4ed8..a79bb1d03 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/AshfangConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/AshfangConfig.java @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.config.features; import at.hannibal2.skyhanni.config.FeatureToggle; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; +import io.github.moulberry.moulconfig.annotations.Accordion; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorColour; import io.github.moulberry.moulconfig.annotations.ConfigOption; @@ -27,16 +28,24 @@ public class AshfangConfig { @Expose public Position nextResetCooldownPos = new Position(10, 10, false, true); + @ConfigOption(name = "Gravity Orbs", desc = "") + @Accordion @Expose - @ConfigOption(name = "Gravity Orbs", desc = "Shows the Gravity Orbs more clearly.") - @ConfigEditorBoolean - @FeatureToggle - public boolean gravityOrbs = false; + public GravityOrbsConfig gravityOrbs = new GravityOrbsConfig(); - @Expose - @ConfigOption(name = "Orbs Color", desc = "Color of the Ashfang Gravity Orbs.") - @ConfigEditorColour - public String gravityOrbsColor = "0:120:255:85:85"; + public static class GravityOrbsConfig { + + @Expose + @ConfigOption(name = "Enabled", desc = "Shows the Gravity Orbs more clearly.") + @ConfigEditorBoolean + @FeatureToggle + public boolean enabled = false; + + @Expose + @ConfigOption(name = "Color", desc = "Color of the Gravity Orbs.") + @ConfigEditorColour + public String color = "0:120:255:85:85"; + } @Expose @ConfigOption(name = "Blazing Souls", desc = "Shows the Blazing Souls more clearly.") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt index 7a993f0de..ff45b6bba 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.farming import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.* @@ -73,6 +74,11 @@ class FarmingWeightDisplay { } } + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(1, "garden.eliteFarmingWeightoffScreenDropMessage", "garden.eliteFarmingWeightOffScreenDropMessage") + } + companion object { private val config get() = SkyHanniMod.feature.garden private val localCounter = mutableMapOf<CropType, Long>() @@ -285,7 +291,7 @@ class FarmingWeightDisplay { SkyHanniMod.coroutineScope.launch { val wasNotLoaded = leaderboardPosition == -1 leaderboardPosition = loadLeaderboardPosition() - if (wasNotLoaded && config.eliteFarmingWeightoffScreenDropMessage) { + if (wasNotLoaded && config.eliteFarmingWeightOffScreenDropMessage) { checkOffScreenLeaderboardChanges() } ProfileStorageData.profileSpecific?.garden?.farmingWeight?.lastFarmingWeightLeaderboard = diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt index 92b699845..b9d6e6b7e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.nether.ashfang import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.features.damageindicator.BossType @@ -14,6 +15,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.awt.Color class AshfangGravityOrbs { + private val config get() = SkyHanniMod.feature.ashfang.gravityOrbs private val texture = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV" + "0L3RleHR1cmUvMWE2OWNjZjdhZDkwNGM5YTg1MmVhMmZmM2Y1YjRlMjNhZGViZjcyZWQxMmQ1ZjI0Yjc4Y2UyZDQ0YjRhMiJ9fX0=" @@ -32,7 +34,7 @@ class AshfangGravityOrbs { fun onRenderWorld(event: RenderWorldLastEvent) { if (!isEnabled()) return - val color = Color(SpecialColour.specialToChromaRGB(SkyHanniMod.feature.ashfang.gravityOrbsColor), true) + val color = Color(SpecialColour.specialToChromaRGB(config.color), true) val playerLocation = LocationUtils.playerLocation() for (orb in orbs) { if (orb.isDead) continue @@ -52,8 +54,12 @@ class AshfangGravityOrbs { orbs.clear() } - private fun isEnabled(): Boolean { - return LorenzUtils.inSkyBlock && SkyHanniMod.feature.ashfang.gravityOrbs && - DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(1, "ashfang.gravityOrbs", "ashfang.gravityOrbs.enabled") + event.move(1, "ashfang.gravityOrbsColor", "ashfang.gravityOrbs.color") } + + private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled && + DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) }
\ No newline at end of file |