diff options
author | Walker Selby <git@walkerselby.com> | 2023-12-11 13:59:52 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-11 22:59:52 +0100 |
commit | d5b4a817e2b9e7e5c88eb0c8212b9a6e678bd92f (patch) | |
tree | bc07923686b77da759b3f12ea535f2e3c02deead /src/main/java/at/hannibal2/skyhanni/config | |
parent | b8ec689ce9bd6fe89e4b825a988edb63fb51b5ab (diff) | |
download | skyhanni-d5b4a817e2b9e7e5c88eb0c8212b9a6e678bd92f.tar.gz skyhanni-d5b4a817e2b9e7e5c88eb0c8212b9a6e678bd92f.tar.bz2 skyhanni-d5b4a817e2b9e7e5c88eb0c8212b9a6e678bd92f.zip |
Internal: Migrate Deprecated Config Values to Enums (#790)
Migrate Deprecated Config Values to Enums. #790
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/config')
20 files changed, 842 insertions, 81 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatSymbols.java b/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatSymbols.java index c8ea29aee..0ea1b9688 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatSymbols.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatSymbols.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.chat; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; @@ -19,6 +20,35 @@ public class ChatSymbols { @Expose @ConfigOption(name = "Chat Symbol Location", desc = "Determines where the symbols should go in chat in relation to the " + "player's name. Hidden will hide all emblems from the chat. §eRequires above setting to be on to hide the symbols.") - @ConfigEditorDropdown(values = {"Left", "Right", "Hidden"}) - public int symbolLocation = 0; + @ConfigEditorDropdown() + public SymbolLocationEntry symbolLocation = SymbolLocationEntry.LEFT; + + public enum SymbolLocationEntry implements HasLegacyId { + LEFT("Left", 0), + RIGHT("Right", 1), + HIDDEN("Hidden)", 2); + + private final String str; + private final int legacyId; + + SymbolLocationEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + SymbolLocationEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/chroma/ChromaConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/chroma/ChromaConfig.java index 81e3b26df..7446063ba 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/chroma/ChromaConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/chroma/ChromaConfig.java @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.config.features.chroma; import at.hannibal2.skyhanni.SkyHanniMod; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorButton; @@ -40,8 +41,38 @@ public class ChromaConfig { @Expose @ConfigOption(name = "Chroma Direction", desc = "Change the slant and direction of the chroma.") - @ConfigEditorDropdown(values = {"Forward + Right", "Forward + Left", "Backward + Right", "Backward + Left"}) - public int chromaDirection = 0; + @ConfigEditorDropdown() + public Direction chromaDirection = Direction.FORWARD_RIGHT; + + public enum Direction implements HasLegacyId { + FORWARD_RIGHT("Forward + Right", 0), + FORWARD_LEFT("Forward + Left", 1), + BACKWARD_RIGHT("Backward + Right", 2), + BACKWARD_LEFT("Backward + Left", 3); + + private final String str; + private final int legacyId; + + Direction(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + Direction(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @ConfigOption(name = "Reset to Default", desc = "Resets all chroma settings to the default.") @ConfigEditorButton(buttonText = "Reset") @@ -57,6 +88,6 @@ public class ChromaConfig { SkyHanniMod.getFeature().chroma.chromaSpeed = 6f; SkyHanniMod.getFeature().chroma.chromaSaturation = 0.75f; SkyHanniMod.getFeature().chroma.allChroma = false; - SkyHanniMod.getFeature().chroma.chromaDirection = 0; + SkyHanniMod.getFeature().chroma.chromaDirection = Direction.FORWARD_RIGHT; } } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/BestiaryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/BestiaryConfig.java index 97c41da3d..1e9c7f4a6 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/combat/BestiaryConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/BestiaryConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.combat; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; @@ -16,22 +17,75 @@ public class BestiaryConfig { @Expose @ConfigOption(name = "Number format", desc = "Short: 1.1k\nLong: 1.100") - @ConfigEditorDropdown(values = {"Short", "Long"}) - public int numberFormat = 0; + @ConfigEditorDropdown() + public NumberFormatEntry numberFormat = NumberFormatEntry.SHORT; + + public enum NumberFormatEntry implements HasLegacyId { + SHORT("Short", 0), + LONG("Long", 1); + + private final String str; + private final int legacyId; + + NumberFormatEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + NumberFormatEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Display type", desc = "Choose what the display should show") - @ConfigEditorDropdown(values = { - "Global to max", - "Global to next tier", - "Lowest total kills", - "Highest total kills", - "Lowest kills needed to max", - "Highest kills needed to max", - "Lowest kills needed to next tier", - "Highest kills needed to next tier" - }) - public int displayType = 0; + @ConfigEditorDropdown() + public DisplayTypeEntry displayType = DisplayTypeEntry.GLOBAL_MAX; + + public enum DisplayTypeEntry implements HasLegacyId { + GLOBAL_MAX("Global to max", 0), + GLOBAL_NEXT("Global to next tier", 1), + LOWEST_TOTAL("Lowest total kills", 2), + HIGHEST_TOTAL("Highest total kills", 3), + LOWEST_MAX("Lowest kills needed to max", 4), + HIGHEST_MAX("Highest kills needed to max", 5), + LOWEST_NEXT("Lowest kills needed to next tier", 6), + HIGHEST_NEXT("Highest kills needed to next tier", 7); + + private final String str; + private final int legacyId; + + DisplayTypeEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + DisplayTypeEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Hide maxed", desc = "Hide maxed mobs.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/damageindicator/DamageIndicatorConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/damageindicator/DamageIndicatorConfig.java index 6986d706c..69cae8a78 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/combat/damageindicator/DamageIndicatorConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/damageindicator/DamageIndicatorConfig.java @@ -13,21 +13,21 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.ARACHNE; -import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.DIANA_MOBS; -import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.DUNGEON_ALL; -import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.GARDEN_PESTS; -import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.INFERNO_DEMONLORD; -import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.NETHER_MINI_BOSSES; -import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.REINDRAKE; -import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.REVENANT_HORROR; -import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.RIFTSTALKER_BLOODFIEND; -import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.SEA_CREATURES; -import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.SVEN_PACKMASTER; -import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.TARANTULA_BROODFATHER; -import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.THE_RIFT_BOSSES; -import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.VANQUISHER; -import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.VOIDGLOOM_SERAPH; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory.ARACHNE; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory.DIANA_MOBS; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory.DUNGEON_ALL; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory.GARDEN_PESTS; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory.INFERNO_DEMONLORD; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory.NETHER_MINI_BOSSES; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory.REINDRAKE; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory.REVENANT_HORROR; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory.RIFTSTALKER_BLOODFIEND; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory.SEA_CREATURES; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory.SVEN_PACKMASTER; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory.TARANTULA_BROODFATHER; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory.THE_RIFT_BOSSES; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory.VANQUISHER; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory.VOIDGLOOM_SERAPH; public class DamageIndicatorConfig { @@ -46,8 +46,38 @@ public class DamageIndicatorConfig { @ConfigOption( name = "Boss Name", desc = "Change how the boss name should be displayed.") - @ConfigEditorDropdown(values = {"Hidden", "Full Name", "Short Name"}) - public int bossName = 1; + @ConfigEditorDropdown() + public NameVisibility bossName = NameVisibility.FULL_NAME; + + public enum NameVisibility implements HasLegacyId { + HIDDEN("Hidden", 0), + FULL_NAME("Full Name", 1), + SHORT_NAME("Short Name", 2), + ; + + private final String str; + private final int legacyId; + + NameVisibility(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + NameVisibility(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption( @@ -56,7 +86,7 @@ public class DamageIndicatorConfig { ) @ConfigEditorDraggableList() //TODO only show currently working and tested features - public List<DamageIndicatorBossEntry> bossesToShow = new ArrayList<>(Arrays.asList( + public List<BossCategory> bossesToShow = new ArrayList<>(Arrays.asList( DUNGEON_ALL, NETHER_MINI_BOSSES, VANQUISHER, @@ -75,7 +105,7 @@ public class DamageIndicatorConfig { )); - public enum DamageIndicatorBossEntry implements HasLegacyId { + public enum BossCategory implements HasLegacyId { DUNGEON_ALL("§bDungeon All", 0), NETHER_MINI_BOSSES("§bNether Mini Bosses", 1), VANQUISHER("§bVanquisher", 2), @@ -107,13 +137,13 @@ public class DamageIndicatorConfig { private final String str; private final int legacyId; - DamageIndicatorBossEntry(String str, int legacyId) { + BossCategory(String str, int legacyId) { this.str = str; this.legacyId = legacyId; } // Constructor if new enum elements are added post-migration - DamageIndicatorBossEntry(String str) { + BossCategory(String str) { this(str, -1); } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/ReputationHelperConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/ReputationHelperConfig.java index cddce2228..0fb516858 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/ReputationHelperConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/ReputationHelperConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.crimsonisle; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; @@ -33,6 +34,34 @@ public class ReputationHelperConfig { @Expose @ConfigOption(name = "Show Locations", desc = "Crimson Isles waypoints for locations to get reputation.") - @ConfigEditorDropdown(values = {"Always", "Only With Hotkey", "Never"}) - public int showLocation = 1; + @ConfigEditorDropdown() + public ShowLocationEntry showLocation = ShowLocationEntry.ONLY_HOTKEY; + + public enum ShowLocationEntry implements HasLegacyId { + ALWAYS("Always", 0), + ONLY_HOTKEY("Only With Hotkey", 1), + NEVER("Never", 2); + private final String str; + private final int legacyId; + + ShowLocationEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + ShowLocationEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/fishing/trophyfishing/ChatMessagesConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/fishing/trophyfishing/ChatMessagesConfig.java index f19fc0d86..3cba03d78 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/fishing/trophyfishing/ChatMessagesConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/fishing/trophyfishing/ChatMessagesConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.fishing.trophyfishing; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; @@ -24,8 +25,36 @@ public class ChatMessagesConfig { "§fStyle 2: §bYou caught a §5Moldfin §6§lGOLD§b. §7(2)\n" + "§fStyle 3: §bYou caught your 2nd §6§lGOLD §5Moldfin§b." ) - @ConfigEditorDropdown(values = {"Style 1", "Style 2", "Style 3"}) - public int design = 0; + @ConfigEditorDropdown() + public DesignFormat design = DesignFormat.STYLE_1; + + public enum DesignFormat implements HasLegacyId { + STYLE_1("Style 1", 0), + STYLE_2("Style 2", 1), + STYLE_3("Style 3", 2); + private final String str; + private final int legacyId; + + DesignFormat(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + DesignFormat(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Show Total Amount", desc = "Show total amount of all rarities at the end of the chat message.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/NextJacobContestConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/NextJacobContestConfig.java index 2da4b7c42..d3162185a 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/NextJacobContestConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/NextJacobContestConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.garden; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import at.hannibal2.skyhanni.config.core.config.Position; import at.hannibal2.skyhanni.features.garden.CropType; import com.google.gson.annotations.Expose; @@ -37,8 +38,38 @@ public class NextJacobContestConfig { @Expose @ConfigOption(name = "Share Contests", desc = "Share the list of upcoming Contests to elitebot.dev for everyone else to then fetch automatically.") - @ConfigEditorDropdown(values = {"Ask When Needed", "Share Automatically", "Disabled"}) - public int shareAutomatically = 0; + @ConfigEditorDropdown() + public ShareContestsEntry shareAutomatically = ShareContestsEntry.ASK; + + public enum ShareContestsEntry implements HasLegacyId { + ASK("Ask When Needed", 0), + AUTO("Share Automatically", 1), + DISABLED("Disabled", 2), + ; + + private final String str; + private final int legacyId; + + ShareContestsEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + ShareContestsEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Warning", desc = "Show a warning shortly before a new Jacob's Contest starts.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/TooltipTweaksConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/TooltipTweaksConfig.java index 560fcaaa7..511e15759 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/TooltipTweaksConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/TooltipTweaksConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.garden; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; @@ -33,8 +34,36 @@ public class TooltipTweaksConfig { "§fShow: §7Crop-specific Fortune indicated as §6[+196]\n" + "§fReplace: §7Edits the total Fortune to include crop-specific Fortune." ) - @ConfigEditorDropdown(values = {"Default", "Show", "Replace"}) - public int cropTooltipFortune = 1; + @ConfigEditorDropdown() + public CropTooltipFortuneEntry cropTooltipFortune = CropTooltipFortuneEntry.SHOW; + + public enum CropTooltipFortuneEntry implements HasLegacyId { + DEFAULT("Default", 0), + SHOW("Show", 1), + REPLACE("Replace", 2); + private final String str; + private final int legacyId; + + CropTooltipFortuneEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + CropTooltipFortuneEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption( diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/composter/ComposterConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/composter/ComposterConfig.java index 700c4fc49..42137eed5 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/composter/ComposterConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/composter/ComposterConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.garden.composter; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.Accordion; @@ -20,13 +21,69 @@ public class ComposterConfig { @Expose @ConfigOption(name = "Overlay Price", desc = "Toggle for Bazaar 'buy order' vs 'instant buy' price in composter overlay.") - @ConfigEditorDropdown(values = {"Instant Buy", "Buy Order"}) - public int overlayPriceType = 0; + @ConfigEditorDropdown() + public OverlayPriceTypeEntry overlayPriceType = OverlayPriceTypeEntry.INSTANT_BUY; + + public enum OverlayPriceTypeEntry implements HasLegacyId { + INSTANT_BUY("Instant Buy", 0), + BUY_ORDER("Buy Order", 1), + ; + private final String str; + private final int legacyId; + + OverlayPriceTypeEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + OverlayPriceTypeEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Retrieve From", desc = "Change where to retrieve the materials from in the composter overlay: The Bazaar or Sacks.") - @ConfigEditorDropdown(values = {"Bazaar", "Sacks"}) - public int retrieveFrom = 0; + @ConfigEditorDropdown() + public RetrieveFromEntry retrieveFrom = RetrieveFromEntry.BAZAAR; + + public enum RetrieveFromEntry implements HasLegacyId { + BAZAAR("Bazaar", 0), + SACKS("Sacks", 1), + ; + private final String str; + private final int legacyId; + + RetrieveFromEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + RetrieveFromEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose public Position overlayOrganicMatterPos = new Position(140, 152, false, true); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/NextConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/NextConfig.java index 188848e48..d11117624 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/NextConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/NextConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.garden.cropmilestones; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; @@ -21,8 +22,36 @@ public class NextConfig { // TODO moulconfig runnable support @Expose @ConfigOption(name = "Sort Type", desc = "Sort the crops by either garden or SkyBlock EXP.") - @ConfigEditorDropdown(values = {"Garden Exp", "SkyBlock Exp"}) - public int bestType = 0; + @ConfigEditorDropdown() + public BestTypeEntry bestType = BestTypeEntry.GARDEN_EXP; + + public enum BestTypeEntry implements HasLegacyId { + GARDEN_EXP("Garden Exp", 0), + SKYBLOCK_EXP("SkyBlock Exp", 1), + ; + private final String str; + private final int legacyId; + + BestTypeEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + BestTypeEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } // TODO moulconfig runnable support @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/pests/PestSpawnConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/pests/PestSpawnConfig.java index ba723acfa..a12f885c3 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/pests/PestSpawnConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/pests/PestSpawnConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.garden.pests; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; @@ -12,8 +13,36 @@ public class PestSpawnConfig { @ConfigOption( name = "Chat Message Format", desc = "Change how the pest spawn chat message should be formatted.") - @ConfigEditorDropdown(values = {"Hypixel Style", "Compact", "Disabled"}) - public int chatMessageFormat = 0; + @ConfigEditorDropdown() + public ChatMessageFormatEntry chatMessageFormat = ChatMessageFormatEntry.HYPIXEL; + + public enum ChatMessageFormatEntry implements HasLegacyId { + HYPIXEL("Hypixel Style", 0), + COMPACT("Compact", 1), + DISABLED("Disabled", 2); + private final String str; + private final int legacyId; + + ChatMessageFormatEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + ChatMessageFormatEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption( diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/VisitorConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/VisitorConfig.java index ff8e09432..7aca44b89 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/VisitorConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/VisitorConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.garden.visitor; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.Accordion; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; @@ -44,8 +45,37 @@ public class VisitorConfig { @Expose @ConfigOption(name = "Highlight Status", desc = "Highlight the status for visitors with a text above or with color.") - @ConfigEditorDropdown(values = {"Color Only", "Name Only", "Both", "Disabled"}) - public int highlightStatus = 2; + @ConfigEditorDropdown() + public HighlightMode highlightStatus = HighlightMode.BOTH; + + public enum HighlightMode implements HasLegacyId { + COLOR("Color Only", 0), + NAME("Name Only", 1), + BOTH("Both", 2), + DISABLED("Disabled", 3); + private final String str; + private final int legacyId; + + HighlightMode(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + HighlightMode(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Colored Name", desc = "Show the visitor name in the color of the rarity.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/ChestValueConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/ChestValueConfig.java index 62eb30385..c9f3e1bd2 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/ChestValueConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/ChestValueConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.inventory; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; @@ -54,13 +55,69 @@ public class ChestValueConfig { @Expose @ConfigOption(name = "Sorting Type", desc = "Price sorting type.") - @ConfigEditorDropdown(values = {"Descending", "Ascending"}) - public int sortingType = 0; + @ConfigEditorDropdown() + public SortingTypeEntry sortingType = SortingTypeEntry.DESCENDING; + + public enum SortingTypeEntry implements HasLegacyId { + DESCENDING("Descending", 0), + ASCENDING("Ascending", 1), + ; + private final String str; + private final int legacyId; + + SortingTypeEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + SortingTypeEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Value formatting Type", desc = "Format of the price.") - @ConfigEditorDropdown(values = {"Short", "Long"}) - public int formatType = 0; + @ConfigEditorDropdown() + public NumberFormatEntry formatType = NumberFormatEntry.SHORT; + + public enum NumberFormatEntry implements HasLegacyId { + SHORT("Short", 0), + LONG("Long", 1); + + private final String str; + private final int legacyId; + + NumberFormatEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + NumberFormatEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Item To Show", desc = "Choose how many items are displayed.\n" + diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/SackDisplayConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/SackDisplayConfig.java index 37eab2be3..91579ac4f 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/SackDisplayConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/SackDisplayConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.inventory; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; @@ -31,8 +32,37 @@ public class SackDisplayConfig { "§eDefault: §72,240/2.2k\n" + "§eFormatted: §72.2k/2.2k\n" + "§eUnformatted: §72,240/2,200") - @ConfigEditorDropdown(values = {"Default", "Formatted", "Unformatted"}) - public int numberFormat = 1; + @ConfigEditorDropdown() + public NumberFormatEntry numberFormat = NumberFormatEntry.FORMATTED; + + public enum NumberFormatEntry implements HasLegacyId { + DEFAULT("Default", 0), + FORMATTED("Formatted", 1), + UNFORMATTED("Unformatted", 2); + + private final String str; + private final int legacyId; + + NumberFormatEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + NumberFormatEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Extra space", desc = "Space between each line of text.") @@ -44,8 +74,38 @@ public class SackDisplayConfig { @Expose @ConfigOption(name = "Sorting Type", desc = "Sorting type of items in sack.") - @ConfigEditorDropdown(values = {"Descending (Stored)", "Ascending (Stored)", "Descending (Price)", "Ascending (Price)"}) - public int sortingType = 0; + @ConfigEditorDropdown() + public SortingTypeEntry sortingType = SortingTypeEntry.DESC_STORED; + + public enum SortingTypeEntry implements HasLegacyId { + DESC_STORED("Descending (Stored)", 0), + ASC_STORED("Ascending (Stored)", 1), + DESC_PRICE("Descending (Price)", 2), + ASC_PRICE("Ascending (Price)", 3); + + private final String str; + private final int legacyId; + + SortingTypeEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + SortingTypeEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Item To Show", desc = "Choose how many items are displayed. (Some sacks have too many items to fit\n" + @@ -71,13 +131,69 @@ public class SackDisplayConfig { @ConfigOption(name = "Price Format", desc = "Format of the price displayed.\n" + "§eFormatted: §7(12k)\n" + "§eUnformatted: §7(12,421)") - @ConfigEditorDropdown(values = {"Formatted", "Unformatted"}) - public int priceFormat = 0; + @ConfigEditorDropdown() + public PriceFormatEntry priceFormat = PriceFormatEntry.FORMATTED; + + public enum PriceFormatEntry implements HasLegacyId { + FORMATTED("Formatted", 0), + UNFORMATTED("Unformatted", 1); + + private final String str; + private final int legacyId; + + PriceFormatEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + PriceFormatEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Show Price From", desc = "Show price from Bazaar or NPC.") - @ConfigEditorDropdown(values = {"Bazaar", "NPC"}) - public int priceFrom = 0; + @ConfigEditorDropdown() + public PriceFrom priceFrom = PriceFrom.BAZAAR; + + public enum PriceFrom implements HasLegacyId { + BAZAAR("Bazaar", 0), + NPC("NPC", 1); + + private final String str; + private final int legacyId; + + PriceFrom(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + PriceFrom(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose public Position position = new Position(144, 139, false, true); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/itemability/FireVeilWandConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/itemability/FireVeilWandConfig.java index a05558d94..9cd157a4f 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/itemability/FireVeilWandConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/itemability/FireVeilWandConfig.java @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.config.features.itemability; +import at.hannibal2.skyhanni.config.HasLegacyId; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorColour; import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; @@ -8,8 +9,37 @@ import io.github.moulberry.moulconfig.annotations.ConfigOption; public class FireVeilWandConfig { @Expose @ConfigOption(name = "Fire Veil Design", desc = "Changes the flame particles of the Fire Veil Wand ability.") - @ConfigEditorDropdown(values = {"Particles", "Line", "Off"}) - public int display = 0; + @ConfigEditorDropdown() + public DisplayEntry display = DisplayEntry.PARTICLES; + + public enum DisplayEntry implements HasLegacyId { + PARTICLES("Particles", 0), + LINE("Line", 1), + OFF("Off", 2), + ; + private final String str; + private final int legacyId; + + DisplayEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + DisplayEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption( diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/HideArmorConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/HideArmorConfig.java index 286249061..cc1939fbf 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/HideArmorConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/HideArmorConfig.java @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.config.features.misc; +import at.hannibal2.skyhanni.config.HasLegacyId; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; @@ -9,8 +10,37 @@ public class HideArmorConfig { @Expose @ConfigOption(name = "Mode", desc = "Hide the armor of players.") - @ConfigEditorDropdown(values = {"All", "Own Armor", "Other's Armor", "Off"}) - public int mode = 3; + @ConfigEditorDropdown() + public ModeEntry mode = ModeEntry.OFF; + + public enum ModeEntry implements HasLegacyId { + ALL("All", 0), + OWN("Own Armor", 1), + OTHERS("Other's Armor", 2), + OFF("Off", 3); + private final String str; + private final int legacyId; + + ModeEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + ModeEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Only Helmet", desc = "Only hide the helmet.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/TrackerConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/TrackerConfig.java index 613adde60..d3a257dc3 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/TrackerConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/TrackerConfig.java @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.config.features.misc; +import at.hannibal2.skyhanni.config.HasLegacyId; import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; @@ -16,8 +17,36 @@ public class TrackerConfig { @Expose @ConfigOption(name = "Show Price From", desc = "Show price from Bazaar or NPC.") - @ConfigEditorDropdown(values = {"Instant Sell", "Sell Offer", "NPC"}) - public int priceFrom = 1; + @ConfigEditorDropdown() + public PriceFromEntry priceFrom = PriceFromEntry.SELL_OFFER; + + public enum PriceFromEntry implements HasLegacyId { + INSTANT_SELL("Instant Sell", 0), + SELL_OFFER("Sell Offer", 1), + NPC("NPC", 2); + private final String str; + private final int legacyId; + + PriceFromEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + PriceFromEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Default Display Mode", desc = "Change the display mode that gets shown on default.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/compacttablist/AdvancedPlayerListConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/compacttablist/AdvancedPlayerListConfig.java index 0bd6360d6..c677fb1db 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/compacttablist/AdvancedPlayerListConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/compacttablist/AdvancedPlayerListConfig.java @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.config.features.misc.compacttablist; +import at.hannibal2.skyhanni.config.HasLegacyId; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; @@ -9,8 +10,40 @@ public class AdvancedPlayerListConfig { @Expose @ConfigOption(name = "Player Sort", desc = "Change the sort order of player names in the tab list.") - @ConfigEditorDropdown(values = {"Rank (Default)", "SB Level", "Name (Abc)", "Ironman/Bingo", "Party/Friends/Guild", "Random"}) - public int playerSortOrder = 0; + @ConfigEditorDropdown() + public PlayerSortEntry playerSortOrder = PlayerSortEntry.RANK; + + public enum PlayerSortEntry implements HasLegacyId { + RANK("Rank (Default)", 0), + SB_LEVEL("SB Level", 1), + NAME("Name (Abc)", 2), + PROFILE_TYPE("Ironman/Bingo", 3), + SOCIAL_STATUS("Party/Friends/Guild", 4), + RANDOM("Random", 5); + + private final String str; + private final int legacyId; + + PlayerSortEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + PlayerSortEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Invert Sort", desc = "Flip the player list order on its head (also works with default rank).") 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/InventoryValueConfig.java index 297a83a1c..50ec181e4 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/InventoryValueConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.rift.motes; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; @@ -17,8 +18,36 @@ public class InventoryValueConfig { @Expose @ConfigOption(name = "Number Format Type", desc = "Short: 1.2M\n" + "Long: 1,200,000") - @ConfigEditorDropdown(values = {"Short", "Long"}) - public int formatType = 0; + @ConfigEditorDropdown() + public NumberFormatEntry formatType = NumberFormatEntry.SHORT; + + public enum NumberFormatEntry implements HasLegacyId { + SHORT("Short", 0), + LONG("Long", 1); + + private final String str; + private final int legacyId; + + NumberFormatEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + NumberFormatEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose public Position position = new Position(126, 156, false, true); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/slayer/blaze/BlazeHellionConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/slayer/blaze/BlazeHellionConfig.java index 4a5e4af8c..08153da05 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/slayer/blaze/BlazeHellionConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/slayer/blaze/BlazeHellionConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.slayer.blaze; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; @@ -28,8 +29,36 @@ public class BlazeHellionConfig { @Expose @ConfigOption(name = "First Dagger", desc = "Select the first, left sided dagger for the display.") - @ConfigEditorDropdown(values = {"Spirit/Crystal", "Ashen/Auric"}) - public int firstDagger = 0; + @ConfigEditorDropdown() + public FirstDaggerEntry firstDagger = FirstDaggerEntry.SPIRIT_OR_CRYSTAL; + + public enum FirstDaggerEntry implements HasLegacyId { + SPIRIT_OR_CRYSTAL("Spirit/Crystal", 0), + ASHEN_OR_AURIC("Ashen/Auric", 1), + ; + private final String str; + private final int legacyId; + + FirstDaggerEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + FirstDaggerEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Hide Chat", desc = "Remove the wrong Blaze Slayer dagger messages from chat.") |