From 247d4d324dc9ce5960d8c94719707d232a89e3ad Mon Sep 17 00:00:00 2001 From: Walker Selby Date: Wed, 29 Nov 2023 23:43:02 +0000 Subject: Migrate Integer to Enums in Config #727 Co-authored-by: hannibal2 <24389977+hannibal002@users.noreply.github.com> --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 +- .../skyhanni/config/ConfigUpdaterMigrator.kt | 4 +- .../at/hannibal2/skyhanni/config/HasLegacyId.java | 26 +++ .../config/features/combat/EnderNodeConfig.java | 116 +++++++++---- .../config/features/combat/MobsConfig.java | 9 - .../damageindicator/DamageIndicatorConfig.java | 119 +++++++++---- .../combat/ghostcounter/GhostCounterConfig.java | 93 ++++++++--- .../features/commands/TabCompleteConfig.java | 1 + .../event/winter/FrozenTreasureConfig.java | 94 ++++++++--- .../config/features/garden/MoneyPerHourConfig.java | 46 ++++- .../cropmilestones/CropMilestonesConfig.java | 98 +++++++++-- .../cropmilestones/MushroomPetPerkConfig.java | 53 +++++- .../garden/visitor/DropsStatisticsConfig.java | 102 ++++++++--- .../garden/visitor/RewardWarningConfig.java | 52 +++++- .../config/features/inventory/InventoryConfig.java | 77 ++++++--- .../features/mining/PowderTrackerConfig.java | 143 +++++++++++----- .../config/features/misc/DiscordRPCConfig.java | 149 ++++++++++------- .../features/misc/TrevorTheTrapperConfig.java | 81 +++++++-- .../features/combat/damageindicator/BossType.kt | 186 +++++++++++---------- .../damageindicator/DamageIndicatorManager.kt | 5 + .../combat/endernodetracker/EnderNodeTracker.kt | 8 +- .../features/combat/ghostcounter/GhostCounter.kt | 8 +- .../combat/ghostcounter/GhostFormatting.kt | 4 +- .../jerry/frozentreasure/FrozenTreasureTracker.kt | 12 +- .../features/garden/farming/CropMoneyDisplay.kt | 12 +- .../features/garden/farming/GardenBestCropTime.kt | 3 +- .../garden/farming/GardenCropMilestoneDisplay.kt | 37 +++- .../garden/visitor/GardenVisitorDropStatistics.kt | 10 +- .../garden/visitor/GardenVisitorFeatures.kt | 5 + .../skyhanni/features/garden/visitor/VisitorAPI.kt | 4 +- .../inventory/ItemDisplayOverlayFeatures.kt | 101 ++++++----- .../skyhanni/features/inventory/ItemStars.kt | 6 +- .../features/mining/powdertracker/PowderTracker.kt | 8 +- .../features/misc/discordrpc/DiscordRPCManager.kt | 36 +++- .../features/misc/discordrpc/DiscordStatus.kt | 5 +- .../features/misc/trevor/TrevorFeatures.kt | 10 ++ .../skyhanni/features/misc/trevor/TrevorTracker.kt | 3 +- .../at/hannibal2/skyhanni/utils/ConfigUtils.kt | 63 +++++++ 38 files changed, 1319 insertions(+), 472 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/config/HasLegacyId.java create mode 100644 src/main/java/at/hannibal2/skyhanni/utils/ConfigUtils.kt (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 117bb2d28..4d18ecdf0 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -424,7 +424,7 @@ class SkyHanniMod { loadModule(PlayerChatModifier()) loadModule(DungeonChatFilter()) loadModule(HideNotClickableItems()) - loadModule(ItemDisplayOverlayFeatures()) + loadModule(ItemDisplayOverlayFeatures) loadModule(CurrentPetDisplay()) loadModule(ExpOrbsOnGroundHider()) loadModule(FandomWikiFromMenus()) diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt index a8ec467d9..6f5fe68ed 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 = 10 + const val CONFIG_VERSION = 11 fun JsonElement.at(chain: List, init: Boolean): JsonElement? { if (chain.isEmpty()) return this if (this !is JsonObject) return null @@ -34,7 +34,7 @@ object ConfigUpdaterMigrator { } } - fun move(since: Int, oldPath: String, newPath: String, transform: (JsonElement) -> JsonElement = { it }) { + fun move(since: Int, oldPath: String, newPath: String = oldPath, transform: (JsonElement) -> JsonElement = { it }) { if (since <= oldVersion) { logger.log("Skipping move from $oldPath to $newPath ($since <= $oldVersion)") return diff --git a/src/main/java/at/hannibal2/skyhanni/config/HasLegacyId.java b/src/main/java/at/hannibal2/skyhanni/config/HasLegacyId.java new file mode 100644 index 000000000..a867cb570 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/HasLegacyId.java @@ -0,0 +1,26 @@ +package at.hannibal2.skyhanni.config; + +/** + * The interface HasLegacyId. + * To be used for config elements that are being migrated from ArrayLists to Enums. + * A legacyId is not needed for new elements. + */ +public interface HasLegacyId { + + /** + * Gets display string. + * + * @return the display string + */ + String toString(); + + /** + * Gets legacy id. This is used for legacy configs that are being migrated to enums. + * New elements do not need a legacyId, and should return -1 + * + * @return the legacy id + */ + default int getLegacyId() { + return -1; + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/EnderNodeConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/EnderNodeConfig.java index 0fd962084..37f6cdfb8 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/combat/EnderNodeConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/EnderNodeConfig.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; @@ -12,6 +13,23 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.COINS_MADE; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.ENCHANTED_ENDER_PEARL; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.ENCHANTED_END_STONE; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.ENCHANTED_OBSIDIAN; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.ENDERMAN_PET; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.ENDERMITE_NEST; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.ENDER_ARMOR; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.GRAND_XP_BOTTLE; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.MAGICAL_RUNE_I; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.MITE_GEL; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.NODES_MINED; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.SHRIMP_THE_FISH; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.SPACER_1; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.SPACER_2; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.TITANIC_XP_BOTTLE; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.TITLE; + public class EnderNodeConfig { @Expose @ConfigOption( @@ -28,36 +46,76 @@ public class EnderNodeConfig { name = "Text Format", desc = "Drag text to change the appearance of the overlay." ) - @ConfigEditorDraggableList( - exampleText = { - "§5§lEnder Node Tracker", - "§d1,303 Ender Nodes Mined", - "§615.3M Coins Made", - " ", - "§b123 §cEndermite Nest", - "§b832 §aEnchanted End Stone", - "§b230 §aEnchanted Obsidian", - "§b1630 §aEnchanted Ender Pearl", - "§b85 §aGrand Experience Bottle", - "§b4 §9Titanic Experience Bottle", - "§b15 §9End Stone Shulker", - "§b53 §9End Stone Geode", - "§b10 §d◆ Magical Rune I", - "§b24 §5Ender Gauntlet", - "§b357 §5Mite Gel", - "§b2 §cShrimp The Fish", - " ", - "§b200 §5Ender Armor", - "§b24 §5Ender Helmet", - "§b24 §5Ender Chestplate", - "§b24 §5Ender Leggings", - "§b24 §5Ender Boots", - "§b24 §5Ender Necklace", - "§f10§7-§a8§7-§93§7-§52§7-§61 §fEnderman Pet", - " " + @ConfigEditorDraggableList() + public Property> textFormat = Property.of(new ArrayList<>(Arrays.asList( + TITLE, + NODES_MINED, + COINS_MADE, + SPACER_1, + ENDERMITE_NEST, + ENCHANTED_END_STONE, + ENCHANTED_OBSIDIAN, + ENCHANTED_ENDER_PEARL, + GRAND_XP_BOTTLE, + TITANIC_XP_BOTTLE, + MAGICAL_RUNE_I, + MITE_GEL, + SHRIMP_THE_FISH, + SPACER_2, + ENDER_ARMOR, + ENDERMAN_PET) + )); + + public enum EnderNodeDisplayEntry implements HasLegacyId { + TITLE("§5§lEnder Node Tracker", 0), + NODES_MINED("§d1,303 Ender Nodes Mined", 1), + COINS_MADE("§615.3M Coins Made", 2), + SPACER_1(" ", 3), + ENDERMITE_NEST("§b123 §cEndermite Nest", 4), + ENCHANTED_END_STONE("§b832 §aEnchanted End Stone", 5), + ENCHANTED_OBSIDIAN("§b230 §aEnchanted Obsidian", 6), + ENCHANTED_ENDER_PEARL("§b1630 §aEnchanted Ender Pearl", 7), + GRAND_XP_BOTTLE("§b85 §aGrand Experience Bottle", 8), + TITANIC_XP_BOTTLE("§b4 §9Titanic Experience Bottle", 9), + END_STONE_SHULKER("§b15 §9End Stone Shulker", 10), + END_STONE_GEODE("§b53 §9End Stone Geode", 11), + MAGICAL_RUNE_I("§b10 §d◆ Magical Rune I", 12), + ENDER_GAUNTLET("§b24 §5Ender Gauntlet", 13), + MITE_GEL("§b357 §5Mite Gel", 14), + SHRIMP_THE_FISH("§b2 §cShrimp The Fish", 15), + SPACER_2(" ", 16), + ENDER_ARMOR("§b200 §5Ender Armor", 17), + ENDER_HELMET("§b24 §5Ender Helmet", 18), + ENDER_CHESTPLATE("§b24 §5Ender Chestplate", 19), + ENDER_LEGGINGS("§b24 §5Ender Leggings", 20), + ENDER_BOOTS("§b24 §5Ender Boots", 21), + ENDER_NECKLACE("§b24 §5Ender Necklace", 22), + ENDERMAN_PET("§f10§7-§a8§7-§93§7-§52§7-§61 §fEnderman Pet", 23), + ; + + private final String str; + private final int legacyId; + + EnderNodeDisplayEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; } - ) - public Property> textFormat = Property.of(new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 14, 15, 16, 17, 23))); + + // Constructor if new enum elements are added post-migration + EnderNodeDisplayEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose public Position position = new Position(10, 80, false, true); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/MobsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/MobsConfig.java index 77731d854..3514c6729 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/combat/MobsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/MobsConfig.java @@ -6,11 +6,6 @@ import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigOption; public class MobsConfig { - - @Expose - @ConfigOption(name = "Highlighters", desc = "") - public boolean highlighters = false; - @Expose @ConfigOption(name = "Area Boss", desc = "Highlight Golden Ghoul, Old Wolf, Voidling Extremist and Millenia-Aged Blaze.") @ConfigEditorBoolean @@ -56,10 +51,6 @@ public class MobsConfig { @FeatureToggle public boolean arachneBossHighlighter = true; - @Expose - @ConfigOption(name = "Respawn Timers", desc = "") - public boolean timers = false; - @Expose @ConfigOption( name = "Area Boss", 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 36ba986e2..6986d706c 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 @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.combat.damageindicator; 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; @@ -12,6 +13,22 @@ 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; + public class DamageIndicatorConfig { @Expose @@ -37,39 +54,79 @@ public class DamageIndicatorConfig { name = "Select Boss", desc = "Change what type of boss you want the damage indicator be enabled for." ) - @ConfigEditorDraggableList( - exampleText = { - "§bDungeon All", - "§bNether Mini Bosses", - "§bVanquisher", - "§bEndstone Protector (not tested)", - "§bEnder Dragon (not finished)", - "§bRevenant Horror", - "§bTarantula Broodfather", - "§bSven Packmaster", - "§bVoidgloom Seraph", - "§bInferno Demonlord", - "§bHeadless Horseman (bugged)", - "§bDungeon Floor 1", - "§bDungeon Floor 2", - "§bDungeon Floor 3", - "§bDungeon Floor 4", - "§bDungeon Floor 5", - "§bDungeon Floor 6", - "§bDungeon Floor 7", - "§bDiana Mobs", - "§bSea Creatures", - "Dummy", - "§bArachne", - "§bThe Rift Bosses", - "§bRiftstalker Bloodfiend", - "§6Reindrake", - "§aGarden Pests" - } - ) + @ConfigEditorDraggableList() //TODO only show currently working and tested features - public List bossesToShow = new ArrayList<>(Arrays.asList(0, 1, 2, 5, 6, 7, 8, 9, 18, 19, 21, 22, 23, 24, 25)); + public List bossesToShow = new ArrayList<>(Arrays.asList( + DUNGEON_ALL, + NETHER_MINI_BOSSES, + VANQUISHER, + REVENANT_HORROR, + TARANTULA_BROODFATHER, + SVEN_PACKMASTER, + VOIDGLOOM_SERAPH, + INFERNO_DEMONLORD, + DIANA_MOBS, + SEA_CREATURES, + ARACHNE, + THE_RIFT_BOSSES, + RIFTSTALKER_BLOODFIEND, + REINDRAKE, + GARDEN_PESTS + + )); + public enum DamageIndicatorBossEntry implements HasLegacyId { + DUNGEON_ALL("§bDungeon All", 0), + NETHER_MINI_BOSSES("§bNether Mini Bosses", 1), + VANQUISHER("§bVanquisher", 2), + ENDERSTONE_PROTECTOR("§bEndstone Protector (not tested)", 3), + ENDER_DRAGON("§bEnder Dragon (not finished)", 4), + REVENANT_HORROR("§bRevenant Horror", 5), + TARANTULA_BROODFATHER("§bTarantula Broodfather", 6), + SVEN_PACKMASTER("§bSven Packmaster", 7), + VOIDGLOOM_SERAPH("§bVoidgloom Seraph", 8), + INFERNO_DEMONLORD("§bInferno Demonlord", 9), + HEADLESS_HORSEMAN("§bHeadless Horseman (bugged)", 10), + DUNGEON_FLOOR_1("§bDungeon Floor 1", 11), + DUNGEON_FLOOR_2("§bDungeon Floor 2", 12), + DUNGEON_FLOOR_3("§bDungeon Floor 3", 13), + DUNGEON_FLOOR_4("§bDungeon Floor 4", 14), + DUNGEON_FLOOR_5("§bDungeon Floor 5", 15), + DUNGEON_FLOOR_6("§bDungeon Floor 6", 16), + DUNGEON_FLOOR_7("§bDungeon Floor 7", 17), + DIANA_MOBS("§bDiana Mobs", 18), + SEA_CREATURES("§bSea Creatures", 19), + DUMMY("Dummy", 20), + ARACHNE("§bArachne", 21), + THE_RIFT_BOSSES("§bThe Rift Bosses", 22), + RIFTSTALKER_BLOODFIEND("§bRiftstalker Bloodfiend", 23), + REINDRAKE("§6Reindrake", 24), + GARDEN_PESTS("§aGarden Pests", 25), + ; + + private final String str; + private final int legacyId; + + DamageIndicatorBossEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + DamageIndicatorBossEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Hide Damage Splash", desc = "Hiding damage splashes near the damage indicator.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/ghostcounter/GhostCounterConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/ghostcounter/GhostCounterConfig.java index 783c4cda5..6bc8ee48d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/combat/ghostcounter/GhostCounterConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/ghostcounter/GhostCounterConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.combat.ghostcounter; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import at.hannibal2.skyhanni.config.core.config.Position; import at.hannibal2.skyhanni.config.features.combat.ghostcounter.textformatting.TextFormattingConfig; import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostUtil; @@ -16,6 +17,16 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterConfig.GhostDisplayEntry.AVG_MAGIC_FIND; +import static at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterConfig.GhostDisplayEntry.GHOSTS_KILLED; +import static at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterConfig.GhostDisplayEntry.GHOST_PER_SORROW; +import static at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterConfig.GhostDisplayEntry.GHOST_SINCE_SORROW; +import static at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterConfig.GhostDisplayEntry.HIGHEST_KILL_COMBO; +import static at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterConfig.GhostDisplayEntry.KILL_COMBO; +import static at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterConfig.GhostDisplayEntry.SCAVENGER_COINS; +import static at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterConfig.GhostDisplayEntry.SORROW; +import static at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterConfig.GhostDisplayEntry.TITLE; + public class GhostCounterConfig { @Expose @@ -29,31 +40,65 @@ public class GhostCounterConfig { name = "Display Text", desc = "Drag text to change the appearance of the overlay." ) - @ConfigEditorDraggableList( - exampleText = { - "§6Ghosts Counter", - " §bGhost Killed: 42", - " §bSorrow: 6", - " §bGhost since Sorrow: 1", - " §bGhosts/Sorrow: 5", - " §bVolta: 6", - " §bPlasma: 8", - " §bGhostly Boots: 1", - " §bBag Of Cash: 4", - " §bAvg Magic Find: 271", - " §bScavenger Coins: 15,000", - " §bKill Combo: 14", - " §bHighest Kill Combo: 96", - " §bSkill XP Gained: 145,648", - " §bBestiary 1: 0/10", - " §bXP/h: 810,410", - " §bKills/h: 420", - " §bETA: 14d", - " §bMoney/h: 13,420,069", - " §bMoney made: 14B" + @ConfigEditorDraggableList() + public List ghostDisplayText = new ArrayList<>(Arrays.asList( + TITLE, + GHOSTS_KILLED, + SORROW, + GHOST_SINCE_SORROW, + GHOST_PER_SORROW, + AVG_MAGIC_FIND, + SCAVENGER_COINS, + KILL_COMBO, + HIGHEST_KILL_COMBO + )); + + public enum GhostDisplayEntry implements HasLegacyId { + TITLE("§6Ghosts Counter", 0), + GHOSTS_KILLED(" §bGhost Killed: 42", 1), + SORROW(" §bSorrow: 6", 2), + GHOST_SINCE_SORROW(" §bGhost since Sorrow: 1", 3), + GHOST_PER_SORROW(" §bGhosts/Sorrow: 5", 4), + VOLTA(" §bVolta: 6", 5), + PLASMA(" §bPlasma: 8", 6), + GHOSTLY_BOOTS(" §bGhostly Boots: 1", 7), + BAG_OF_CASH(" §bBag Of Cash: 4", 8), + AVG_MAGIC_FIND(" §bAvg Magic Find: 271", 9), + SCAVENGER_COINS(" §bScavenger Coins: 15,000", 10), + KILL_COMBO(" §bKill Combo: 14", 11), + HIGHEST_KILL_COMBO(" §bHighest Kill Combo: 96", 12), + SKILL_XP_GAINED(" §bSkill XP Gained: 145,648", 13), + BESTIARY(" §bBestiary 1: 0/10", 14), + XP_PER_HOUR(" §bXP/h: 810,410", 15), + KILLS_PER_HOUR(" §bKills/h: 420", 16), + ETA(" §bETA: 14d", 17), + MONEY_PER_HOUR(" §bMoney/h: 13,420,069", 18), + MONEY_MADE(" §bMoney made: 14B", 19), + ; + + private final String str; + private final int legacyId; + + GhostDisplayEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; } - ) - public List ghostDisplayText = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 9, 10, 11, 12)); + + // Constructor if new enum elements are added post-migration + GhostDisplayEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @ConfigOption(name = "Text Formatting", desc = "") @Accordion diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/commands/TabCompleteConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/commands/TabCompleteConfig.java index 6e3420a59..b7edd0e07 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/commands/TabCompleteConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/commands/TabCompleteConfig.java @@ -15,6 +15,7 @@ public class TabCompleteConfig { @Expose @ConfigOption(name = "Island Players", desc = "Tab complete other players on the same island.") + @ConfigEditorBoolean public boolean islandPlayers = true; @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/winter/FrozenTreasureConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/event/winter/FrozenTreasureConfig.java index 2b41265a6..a1f378d08 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/event/winter/FrozenTreasureConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/winter/FrozenTreasureConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.event.winter; 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; @@ -11,6 +12,20 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.COMPACT_PROCS; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.ENCHANTED_ICE; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.ENCHANTED_PACKED_ICE; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.GLACIAL_FRAGMENT; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.GLACIAL_TALISMAN; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.GREEN_GIFT; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.ICE_PER_HOUR; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.RED_GIFT; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.SPACER_1; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.TITLE; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.TOTAL_ICE; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.TREASURES_MINED; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.WHITE_GIFT; + public class FrozenTreasureConfig { @Expose @@ -28,28 +43,65 @@ public class FrozenTreasureConfig { name = "Text Format", desc = "Drag text to change the appearance of the overlay." ) - @ConfigEditorDraggableList( - exampleText = { - "§1§lFrozen Treasure Tracker", - "§61,636 Treasures Mined", - "§33.2m Total Ice", - "§3342,192 Ice/hr", - "§81,002 Compact Procs", - " ", - "§b182 §fWhite Gift", - "§b94 §aGreen Gift", - "§b17 §9§cRed Gift", - "§b328 §fPacked Ice", - "§b80 §aEnchanted Ice", - "§b4 §9Enchanted Packed Ice", - "§b182 §aIce Bait", - "§b3 §aGlowy Chum Bait", - "§b36 §5Glacial Fragment", - "§b6 §fGlacial Talisman", - " ", + @ConfigEditorDraggableList() + public List textFormat = new ArrayList<>(Arrays.asList( + TITLE, + TREASURES_MINED, + TOTAL_ICE, + ICE_PER_HOUR, + COMPACT_PROCS, + SPACER_1, + WHITE_GIFT, + GREEN_GIFT, + RED_GIFT, + ENCHANTED_ICE, + ENCHANTED_PACKED_ICE, + GLACIAL_FRAGMENT, + GLACIAL_TALISMAN + )); + + public enum FrozenTreasureDisplayEntry implements HasLegacyId { + TITLE("§1§lFrozen Treasure Tracker", 0), + TREASURES_MINED("§61,636 Treasures Mined", 1), + TOTAL_ICE("§33.2m Total Ice", 2), + ICE_PER_HOUR("§3342,192 Ice/hr", 3), + COMPACT_PROCS("§81,002 Compact Procs", 4), + SPACER_1(" ", 5), + WHITE_GIFT("§b182 §fWhite Gift", 6), + GREEN_GIFT("§b94 §aGreen Gift", 7), + RED_GIFT("§b17 §9§cRed Gift", 8), + PACKED_ICE("§b328 §fPacked Ice", 9), + ENCHANTED_ICE("§b80 §aEnchanted Ice", 10), + ENCHANTED_PACKED_ICE("§b4 §9Enchanted Packed Ice", 11), + ICE_BAIT("§b182 §aIce Bait", 12), + GLOWY_CHUM_BAIT("§b3 §aGlowy Chum Bait", 13), + GLACIAL_FRAGMENT("§b36 §5Glacial Fragment", 14), + GLACIAL_TALISMAN("§b6 §fGlacial Talisman", 15), + SPACER_2(" ", 16); + + private final String str; + private final int legacyId; + + FrozenTreasureDisplayEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; } - ) - public List textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 14, 15)); + + // Constructor if new enum elements are added post-migration + FrozenTreasureDisplayEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Only in Glacial Cave", desc = "Only shows the overlay while in the Glacial Cave.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/MoneyPerHourConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/MoneyPerHourConfig.java index a568ebf0f..77c9eddc2 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/MoneyPerHourConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/MoneyPerHourConfig.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 com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; @@ -12,6 +13,10 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.garden.MoneyPerHourConfig.CustomFormatEntry.INSTANT_SELL; +import static at.hannibal2.skyhanni.config.features.garden.MoneyPerHourConfig.CustomFormatEntry.NPC_PRICE; +import static at.hannibal2.skyhanni.config.features.garden.MoneyPerHourConfig.CustomFormatEntry.SELL_OFFER; + public class MoneyPerHourConfig { @Expose @ConfigOption(name = "Show Money per Hour", @@ -70,14 +75,43 @@ public class MoneyPerHourConfig { name = "Custom Format", desc = "Set what prices to show") @ConfigEditorDraggableList( - exampleText = { - "§eSell Offer", - "§eInstant Sell", - "§eNPC Price" - }, requireNonEmpty = true ) - public List customFormat = new ArrayList<>(Arrays.asList(0, 1, 2)); + public List customFormat = new ArrayList<>(Arrays.asList( + SELL_OFFER, + INSTANT_SELL, + NPC_PRICE + )); + + public enum CustomFormatEntry implements HasLegacyId { + SELL_OFFER("§eSell Offer", 0), + INSTANT_SELL("§eInstant Sell", 1), + NPC_PRICE("§eNPC Price", 2), + ; + + private final String str; + private final int legacyId; + + CustomFormatEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + CustomFormatEntry(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/cropmilestones/CropMilestonesConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/CropMilestonesConfig.java index 053ffe900..8f2d5a450 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/CropMilestonesConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/CropMilestonesConfig.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.Accordion; @@ -15,6 +16,14 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.CropMilestonesConfig.MilestoneTextEntry.BLOCKS_PER_SECOND; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.CropMilestonesConfig.MilestoneTextEntry.CROPS_PER_MINUTE; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.CropMilestonesConfig.MilestoneTextEntry.MILESTONE_TIER; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.CropMilestonesConfig.MilestoneTextEntry.NUMBER_OUT_OF_TOTAL; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.CropMilestonesConfig.MilestoneTextEntry.TIME; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.CropMilestonesConfig.MilestoneTextEntry.TITLE; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.CropMilestonesConfig.TimeFormatEntry.YEAR; + public class CropMilestonesConfig { @Expose @ConfigOption( @@ -38,8 +47,40 @@ public class CropMilestonesConfig { @ConfigOption( name = "Time Format", desc = "Change the highest time unit to show (1h30m vs 90min)") - @ConfigEditorDropdown(values = {"Year", "Day", "Hour", "Minute", "Second"}) - public Property highestTimeFormat = Property.of(0); + @ConfigEditorDropdown() + public Property highestTimeFormat = Property.of(YEAR); + + public enum TimeFormatEntry implements HasLegacyId { + YEAR("Year", 0), + DAY("Day", 1), + HOUR("Hour", 2), + MINUTE("Minute", 3), + SECOND("Second", 4), + ; + + private final String str; + private final int legacyId; + + TimeFormatEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + TimeFormatEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption( @@ -54,18 +95,49 @@ public class CropMilestonesConfig { desc = "Drag text to change the appearance of the overlay.\n" + "Hold a farming tool to show the overlay." ) - @ConfigEditorDraggableList( - exampleText = { - "§6Crop Milestones", - "§7Pumpkin Tier 22", - "§e12,300§8/§e100,000", - "§7In §b12m 34s", - "§7Crops/Minute§8: §e12,345", - "§7Blocks/Second§8: §e19.85", - "§7Percentage: §e12.34%", + @ConfigEditorDraggableList() + public List text = new ArrayList<>(Arrays.asList( + TITLE, + MILESTONE_TIER, + NUMBER_OUT_OF_TOTAL, + TIME, + CROPS_PER_MINUTE, + BLOCKS_PER_SECOND + )); + + public enum MilestoneTextEntry implements HasLegacyId { + TITLE("§6Crop Milestones", 0), + MILESTONE_TIER("§7Pumpkin Tier 22", 1), + NUMBER_OUT_OF_TOTAL("§e12,300§8/§e100,000", 2), + TIME("§7In §b12m 34s", 3), + CROPS_PER_MINUTE("§7Crops/Minute§8: §e12,345", 4), + BLOCKS_PER_SECOND("§7Blocks/Second§8: §e19.85", 5), + PERCENTAGE("§7Percentage: §e12.34%", 6), + ; + + private final String str; + private final int legacyId; + + MilestoneTextEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; } - ) - public List text = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5)); + + // Constructor if new enum elements are added post-migration + MilestoneTextEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Block Broken Precision", desc = "The amount of decimals displayed in blocks/second.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/MushroomPetPerkConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/MushroomPetPerkConfig.java index 66ef83a4c..2cd4cd911 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/MushroomPetPerkConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/MushroomPetPerkConfig.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; @@ -11,6 +12,11 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.MushroomPetPerkConfig.MushroomTextEntry.MUSHROOM_TIER; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.MushroomPetPerkConfig.MushroomTextEntry.NUMBER_OUT_OF_TOTAL; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.MushroomPetPerkConfig.MushroomTextEntry.TIME; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.MushroomPetPerkConfig.MushroomTextEntry.TITLE; + // TODO moulconfig runnable support public class MushroomPetPerkConfig { @Expose @@ -27,16 +33,45 @@ public class MushroomPetPerkConfig { desc = "Drag text to change the appearance of the overlay.\n" + "Hold a farming tool to show the overlay." ) - @ConfigEditorDraggableList( - exampleText = { - "§6Mooshroom Cow Perk", - "§7Mushroom Tier 8", - "§e6,700§8/§e15,000", - "§7In §b12m 34s", - "§7Percentage: §e12.34%", + @ConfigEditorDraggableList() + public List text = new ArrayList<>(Arrays.asList( + TITLE, + MUSHROOM_TIER, + NUMBER_OUT_OF_TOTAL, + TIME + )); + + public enum MushroomTextEntry implements HasLegacyId { + TITLE("§6Mooshroom Cow Perk", 0), + MUSHROOM_TIER("§7Mushroom Tier 8", 1), + NUMBER_OUT_OF_TOTAL("§e6,700§8/§e15,000", 2), + TIME("§7In §b12m 34s", 3), + PERCENTAGE("§7Percentage: §e12.34%", 4), + ; + + private final String str; + private final int legacyId; + + MushroomTextEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; } - ) - public List text = new ArrayList<>(Arrays.asList(0, 1, 2, 3)); + + // Constructor if new enum elements are added post-migration + MushroomTextEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose public Position pos = new Position(-112, -143, false, true); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/DropsStatisticsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/DropsStatisticsConfig.java index 7fd332d25..6c4b0856f 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/DropsStatisticsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/DropsStatisticsConfig.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 at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; @@ -11,6 +12,19 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.ACCEPTED; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.COINS_SPENT; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.COPPER; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.DEDICATION_IV; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.DENIED; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.FARMING_EXP; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.GREEN_BANDANA; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.OVERGROWN_GRASS; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.SPACER_1; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.TITLE; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.TOTAL_VISITORS; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.VISITORS_BY_RARITY; + public class DropsStatisticsConfig { @Expose @@ -27,34 +41,70 @@ public class DropsStatisticsConfig { name = "Text Format", desc = "Drag text to change the appearance of the overlay." ) - @ConfigEditorDraggableList( - exampleText = { - "§e§lVisitor Statistics", - "§e1,636 Total", - "§a1,172§f-§9382§f-§681§f-§c1", - "§21,382 Accepted", - "§c254 Denied", - " ", - "§c62,072 Copper", - "§33.2m Farming EXP", - "§647.2m Coins Spent", - "§b23 §9Flowering Bouquet", - "§b4 §9Overgrown Grass", - "§b2 §5Green Bandana", - "§b1 §9Dedication IV", - "§b6 §b◆ Music Rune I", - "§b1 §cSpace Helmet", - "§b1 §9Cultivating I", - "§b1 §9Replenish I", - " ", // If they want another empty row - "§212,600 Garden EXP", - "§b4.2k Bits", - "§220k Mithril Powder", - "§d18k Gemstone Powder", + @ConfigEditorDraggableList() + public List textFormat = new ArrayList<>(Arrays.asList( + TITLE, + TOTAL_VISITORS, + VISITORS_BY_RARITY, + ACCEPTED, + DENIED, + SPACER_1, + COPPER, + FARMING_EXP, + COINS_SPENT, + OVERGROWN_GRASS, + GREEN_BANDANA, + DEDICATION_IV + )); + + public enum DropsStatisticsTextEntry implements HasLegacyId { + TITLE("§e§lVisitor Statistics", 0), + TOTAL_VISITORS("§e1,636 Total", 1), + VISITORS_BY_RARITY("§a1,172§f-§9382§f-§681§f-§d2§f-§c1", 2), + ACCEPTED("§21,382 Accepted", 3), + DENIED("§c254 Denied", 4), + SPACER_1(" ", 5), + COPPER("§c62,072 Copper", 6), + FARMING_EXP("§33.2m Farming EXP", 7), + COINS_SPENT("§647.2m Coins Spent", 8), + FLOWERING_BOUQUET("§b23 §9Flowering Bouquet", 9), + OVERGROWN_GRASS("§b4 §9Overgrown Grass", 10), + GREEN_BANDANA("§b2 §5Green Bandana", 11), + DEDICATION_IV("§b1 §9Dedication IV", 12), + MUSIC_RUNE_I("§b6 §b◆ Music Rune I", 13), + SPACE_HELMET("§b1 §cSpace Helmet", 14), + CULTIVATING_I("§b1 §9Cultivating I", 15), + REPLENISH_I("§b1 §9Replenish I", 16), + SPACER_2(" ", 17), + GARDEN_EXP("§212,600 Garden EXP", 18), + BITS("§b4.2k Bits", 19), + MITHRIL_POWDER("§220k Mithril Powder", 20), + GEMSTONE_POWDER("§d18k Gemstone Powder", 21), + ; + + private final String str; + private final int legacyId; + + DropsStatisticsTextEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; } - ) - public List textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12)); + // Constructor if new enum elements are added post-migration + DropsStatisticsTextEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Display Numbers First", desc = "Determines whether the number or drop name displays first. " + diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/RewardWarningConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/RewardWarningConfig.java index f83fc5518..bd3f158ff 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/RewardWarningConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/RewardWarningConfig.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.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorDraggableList; @@ -12,6 +13,13 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.garden.visitor.RewardWarningConfig.ItemWarnEntry.CULTIVATING_I; +import static at.hannibal2.skyhanni.config.features.garden.visitor.RewardWarningConfig.ItemWarnEntry.DEDICATION_IV; +import static at.hannibal2.skyhanni.config.features.garden.visitor.RewardWarningConfig.ItemWarnEntry.GREEN_BANDANA; +import static at.hannibal2.skyhanni.config.features.garden.visitor.RewardWarningConfig.ItemWarnEntry.MUSIC_RUNE; +import static at.hannibal2.skyhanni.config.features.garden.visitor.RewardWarningConfig.ItemWarnEntry.OVERGROWN_GRASS; +import static at.hannibal2.skyhanni.config.features.garden.visitor.RewardWarningConfig.ItemWarnEntry.SPACE_HELMET; + public class RewardWarningConfig { @Expose @@ -58,5 +66,47 @@ public class RewardWarningConfig { "§9Replenish I", } ) - public List drops = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5, 6)); + public List drops = new ArrayList<>(Arrays.asList( + OVERGROWN_GRASS, + GREEN_BANDANA, + DEDICATION_IV, + MUSIC_RUNE, + SPACE_HELMET, + CULTIVATING_I + )); + + public enum ItemWarnEntry implements HasLegacyId { + FLOWERING_BOUQUET("§9Flowering Bouquet", 0), + OVERGROWN_GRASS("§9Overgrown Grass", 1), + GREEN_BANDANA("§9Green Bandana", 2), + DEDICATION_IV("§9Dedication IV", 3), + MUSIC_RUNE("§9Music Rune", 4), + SPACE_HELMET("§cSpace Helmet", 5), + CULTIVATING_I("§9Cultivating I", 6), + REPLENISH_I("§9Replenish I", 7), + ; + + private final String str; + private final int legacyId; + + ItemWarnEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + ItemWarnEntry(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/inventory/InventoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java index d124e6982..0586e9e33 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.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.features.inventory.helper.HelperConfig; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.Accordion; @@ -13,6 +14,11 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.LARVA_HOOK; +import static at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.NEW_YEAR_CAKE; +import static at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.RANCHERS_BOOTS_SPEED; +import static at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.VACUUM_GARDEN; + public class InventoryConfig { @Expose @@ -55,28 +61,57 @@ public class InventoryConfig { name = "Item Number", desc = "Showing the item number as a stack size for these items." ) - @ConfigEditorDraggableList( - exampleText = { - "§bMaster Star Tier", - "§bMaster Skull Tier", - "§bDungeon Head Floor Number", - "§bNew Year Cake", - "§bPet Level", - "§bMinion Tier", - "§bCrimson Armor", - "§7(Removed)", - "§bKuudra Key", - "§bSkill Level", - "§bCollection Level", - "§bRancher's Boots speed", - "§bLarva Hook", - "§bDungeon Potion Level", - "§bVacuum (Garden)", - "§bBottle Of Jyrre", - "§bEdition Number" + @ConfigEditorDraggableList() + public List itemNumberAsStackSize = new ArrayList<>(Arrays.asList( + NEW_YEAR_CAKE, + RANCHERS_BOOTS_SPEED, + LARVA_HOOK, + VACUUM_GARDEN + )); + + public enum ItemNumberEntry implements HasLegacyId { + MASTER_STAR_TIER("§bMaster Star Tier", 0), + MASTER_SKULL_TIER("§bMaster Skull Tier", 1), + DUNGEON_HEAD_FLOOR_NUMBER("§bDungeon Head Floor Number", 2), + NEW_YEAR_CAKE("§bNew Year Cake", 3), + PET_LEVEL("§bPet Level", 4), + MINION_TIER("§bMinion Tier", 5), + CRIMSON_ARMOR("§bCrimson Armor", 6), + REMOVED("§7(Removed)", 7), + KUUDRA_KEY("§bKuudra Key", 8), + SKILL_LEVEL("§bSkill Level", 9), + COLLECTION_LEVEL("§bCollection Level", 10), + RANCHERS_BOOTS_SPEED("§bRancher's Boots speed", 11), + LARVA_HOOK("§bLarva Hook", 12), + DUNGEON_POTION_LEVEL("§bDungeon Potion Level", 13), + VACUUM_GARDEN("§bVacuum (Garden)", 14), + BOTTLE_OF_JYRRE("§bBottle Of Jyrre", 15), + EDITION_NUMBER("§bEdition Number", 16), + ; + + private final String str; + private final int legacyId; + + ItemNumberEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; } - ) - public List itemNumberAsStackSize = new ArrayList<>(Arrays.asList(3, 11, 12, 14)); + + // Constructor if new enum elements are added post-migration + ItemNumberEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = " Vacuum Bag Cap", desc = "Capping the Garden Vacuum Bag item number display to 40.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/mining/PowderTrackerConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/mining/PowderTrackerConfig.java index 50bff2a9b..1e658c5a2 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/mining/PowderTrackerConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/mining/PowderTrackerConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.mining; 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; @@ -12,6 +13,26 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.AMBER; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.AMETHYST; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.DIAMOND_ESSENCE; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.DISPLAY_MODE; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.DOUBLE_POWDER; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.ELECTRON; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.FTX; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.GEMSTONE_POWDER; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.GOLD_ESSENCE; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.JADE; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.MITHRIL_POWDER; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.ROBOTRON; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.RUBY; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.SAPPHIRE; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.SPACER_1; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.SPACER_2; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.TITLE; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.TOPAZ; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.TOTAL_CHESTS; + public class PowderTrackerConfig { @Expose @@ -35,48 +56,88 @@ public class PowderTrackerConfig { name = "Text Format", desc = "Drag text to change the appearance of the overlay." ) - @ConfigEditorDraggableList( - exampleText = { - "§b§lPowder Tracker", - "§7Display Mode: §a[Total] §e[This Session]", - "§d852 Total chests Picked §7(950/h)", - "§bx2 Powder: §aActive!", - "§b250,420 §aMithril Powder §7(350,000/h)", - "§b250,420 §dGemstone Powder §7(350,000/h)", - "", - "§b129 §bDiamond Essence §7(600/h)", - "§b234 §6Gold Essence §7(700/h)", - "", - "§50§7-§90§7-§a0§f-0 §cRuby Gemstone", - "§50§7-§90§7-§a0§f-0 §bSapphire Gemstone", - "§50§7-§90§7-§a0§f-0 §6Amber Gemstone", - "§50§7-§90§7-§a0§f-0 §5Amethyst Gemstone", - "§50§7-§90§7-§a0§f-0 §aJade Gemstone", - "§50§7-§90§7-§a0§f-0 §eTopaz Gemstone", - - "§b14 §9FTX 3070", - "§b14 §9Electron Transmitter", - "§b14 §9Robotron Reflector", - "§b14 §9Superlite Motor", - "§b14 §9Control Switch", - "§b14 §9Synthetic Heart", - "§b14 §9Total Robot Parts", - - "§90§7-§a0§7-§c0§f-§e0§f-§30 §fGoblin Egg", - - "§b12 §aWishing Compass", - - "§b320 §aSludge Juice", - "§b2 §9Ascension Rope", - "§b6 §5Treasurite", - "§b4 §6Jungle Heart", - "§b1 §5Pickonimbus 2000", - "§b14 §aYoggie", - "§b9 §fPrehistoric Egg", - "§b25 §aOil Barrel" + @ConfigEditorDraggableList() + public Property> textFormat = Property.of(new ArrayList<>(Arrays.asList( + TITLE, + DISPLAY_MODE, + TOTAL_CHESTS, + DOUBLE_POWDER, + MITHRIL_POWDER, + GEMSTONE_POWDER, + SPACER_1, + DIAMOND_ESSENCE, + GOLD_ESSENCE, + SPACER_2, + RUBY, + SAPPHIRE, + AMBER, + AMETHYST, + JADE, + TOPAZ, + FTX, + ELECTRON, + ROBOTRON + ))); + + public enum PowderDisplayEntry implements HasLegacyId { + TITLE("§b§lPowder Tracker", 0), + DISPLAY_MODE("§7Display Mode: §a[Total] §e[This Session]", 1), + TOTAL_CHESTS("§d852 Total chests Picked §7(950/h)", 2), + DOUBLE_POWDER("§bx2 Powder: §aActive!", 3), + MITHRIL_POWDER("§b250,420 §aMithril Powder §7(350,000/h)", 4), + GEMSTONE_POWDER("§b250,420 §dGemstone Powder §7(350,000/h)", 5), + SPACER_1("", 6), + DIAMOND_ESSENCE("§b129 §bDiamond Essence §7(600/h)", 7), + GOLD_ESSENCE("§b234 §6Gold Essence §7(700/h)", 8), + SPACER_2("", 9), + RUBY("§50§7-§90§7-§a0§f-0 §cRuby Gemstone", 10), + SAPPHIRE("§50§7-§90§7-§a0§f-0 §bSapphire Gemstone", 11), + AMBER("§50§7-§90§7-§a0§f-0 §6Amber Gemstone", 12), + AMETHYST("§50§7-§90§7-§a0§f-0 §5Amethyst Gemstone", 13), + JADE("§50§7-§90§7-§a0§f-0 §aJade Gemstone", 14), + TOPAZ("§50§7-§90§7-§a0§f-0 §eTopaz Gemstone", 15), + FTX("§b14 §9FTX 3070", 16), + ELECTRON("§b14 §9Electron Transmitter", 17), + ROBOTRON("§b14 §9Robotron Reflector", 18), + SUPERLITE("§b14 §9Superlite Motor", 19), + CONTROL_SWITCH("§b14 §9Control Switch", 20), + SYNTHETIC_HEART("§b14 §9Synthetic Heart", 21), + TOTAL_ROBOT_PARTS("§b14 §9Total Robot Parts", 22), + GOBLIN_EGGS("§90§7-§a0§7-§c0§f-§e0§f-§30 §fGoblin Egg", 23), + WISHING_COMPASS("§b12 §aWishing Compass", 24), + SLUDGE_JUICE("§b320 §aSludge Juice", 25), + ASCENSION_ROPE("§b2 §9Ascension Rope", 26), + TREASURITE("§b6 §5Treasurite", 27), + JUNGLE_HEART("§b4 §6Jungle Heart", 28), + PICKONIMBUS("§b1 §5Pickonimbus 2000", 29), + YOGGIE("§b14 §aYoggie", 30), + PREHISTORIC_EGG("§b9 §fPrehistoric Egg", 31), + OIL_BARREL("§b25 §aOil Barrel", 32), + ; + + private final String str; + private final int legacyId; + + PowderDisplayEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; } - ) - public Property> textFormat = Property.of(new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18))); + + // Constructor if new enum elements are added post-migration + PowderDisplayEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose public Position position = new Position(-274, 0, false, true); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/DiscordRPCConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/DiscordRPCConfig.java index ab4a18d47..aa7a1d4b7 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/DiscordRPCConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/DiscordRPCConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.misc; 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.ConfigEditorDraggableList; @@ -13,6 +14,13 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.misc.DiscordRPCConfig.LineEntry.NOTHING; +import static at.hannibal2.skyhanni.config.features.misc.DiscordRPCConfig.PriorityEntry.AFK; +import