aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-16 21:12:04 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-16 21:12:04 +0200
commite2b9f9d9c556ff54bbe0f3b8009efebefec2f798 (patch)
tree12804e2999b72f54e05bf17352c2e155173ee472 /src/main/java
parente05c91c7b7ed1ae2587ae4ac9b90caae9adceff5 (diff)
downloadskyhanni-e2b9f9d9c556ff54bbe0f3b8009efebefec2f798.tar.gz
skyhanni-e2b9f9d9c556ff54bbe0f3b8009efebefec2f798.tar.bz2
skyhanni-e2b9f9d9c556ff54bbe0f3b8009efebefec2f798.zip
migrate trophy fishing config to use @Accordion
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java131
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt30
4 files changed, 105 insertions, 76 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java
index 50e60191a..1582c734a 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java
@@ -9,74 +9,79 @@ import org.lwjgl.input.Keyboard;
public class FishingConfig {
- @ConfigOption(name = "Trophy Fishing", desc = "")
- @ConfigEditorAccordion(id = 0)
- public boolean trophyFishing = false;
-
- @Expose
- @ConfigOption(
- name = "Trophy Counter",
- desc = "Counts Trophy messages from chat and tells you how many you have found."
- )
- @ConfigEditorBoolean
- @ConfigAccordionId(id = 0)
- @FeatureToggle
- public boolean trophyCounter = false;
-
- @Expose
- @ConfigOption(
- name = "Trophy Counter Design",
- desc = "§fStyle 1: §72. §6§lGOLD §5Moldfin\n" +
- "§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"})
- @ConfigAccordionId(id = 0)
- public int trophyDesign = 0;
-
- @Expose
- @ConfigOption(name = "Hide Repeated Catches", desc = "Delete past catches of the same Trophy Fish from chat.")
- @ConfigEditorBoolean
- @ConfigAccordionId(id = 0)
- public boolean trophyFishDuplicateHider = false;
-
@Expose
- @ConfigOption(name = "Show total amount", desc = "Show total amount of all rarities at the end of the chat message.")
- @ConfigEditorBoolean
- @ConfigAccordionId(id = 0)
- public boolean trophyFishTotalAmount = false;
-
- @Expose
- @ConfigOption(name = "Trophy Fish Info", desc = "Show information and stats about a Trophy Fish when hovering over a catch message in chat.")
- @ConfigEditorBoolean
- @ConfigAccordionId(id = 0)
- public boolean trophyFishTooltip = true;
+ @ConfigOption(name = "Trophy Fishing", desc = "")
+ @Accordion
+ public TrophyFishingConfig trophyFishing = new TrophyFishingConfig();
- @Expose
- @ConfigOption(name = "Bronze Duplicates", desc = "Hide duplicate messages for bronze Trophy Fishes from chat.")
- @ConfigEditorBoolean
- @ConfigAccordionId(id = 0)
- public boolean trophyFishBronzeHider = false;
+ public static class TrophyFishingConfig {
- @Expose
- @ConfigOption(name = "Silver Duplicates", desc = "Hide duplicate messages for silver Trophy Fishes from chat.")
- @ConfigEditorBoolean
- @ConfigAccordionId(id = 0)
- public boolean trophyFishSilverHider = false;
+ @Expose
+ @ConfigOption(name = "Trophy Fishing Chat Messages", desc = "")
+ @Accordion
+ public ChatMessagesConfig chatMessages = new ChatMessagesConfig();
+
+ public static class ChatMessagesConfig {
+
+ @Expose
+ @ConfigOption(
+ name = "Trophy Counter",
+ desc = "Counts Trophy messages from chat and tells you how many you have found."
+ )
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean enabled = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Trophy Counter Design",
+ desc = "§fStyle 1: §72. §6§lGOLD §5Moldfin\n" +
+ "§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;
+
+ @Expose
+ @ConfigOption(name = "Show total amount", desc = "Show total amount of all rarities at the end of the chat message.")
+ @ConfigEditorBoolean
+ public boolean totalAmount = false;
+
+ @Expose
+ @ConfigOption(name = "Trophy Fish Info", desc = "Show information and stats about a Trophy Fish when hovering over a catch message in chat.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean tooltip = true;
+
+ @Expose
+ @ConfigOption(name = "Hide Repeated Catches", desc = "Delete past catches of the same Trophy Fish from chat.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean duplicateHider = false;
+
+ @Expose
+ @ConfigOption(name = "Bronze Duplicates", desc = "Hide duplicate messages for bronze Trophy Fishes from chat.")
+ @ConfigEditorBoolean
+ public boolean bronzeHider = false;
+
+ @Expose
+ @ConfigOption(name = "Silver Duplicates", desc = "Hide duplicate messages for silver Trophy Fishes from chat.")
+ @ConfigEditorBoolean
+ public boolean silverHider = false;
+ }
- @Expose
- @ConfigOption(name = "Fillet Tooltip", desc = "Show fillet value of Trophy Fish in tooltip.")
- @ConfigEditorBoolean
- @ConfigAccordionId(id = 0)
- @FeatureToggle
- public boolean trophyFilletTooltip = true;
+ @Expose
+ @ConfigOption(name = "Fillet Tooltip", desc = "Show fillet value of Trophy Fish in tooltip.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean filletTooltip = true;
- @Expose
- @ConfigOption(name = "Odger Waypoint", desc = "Show the Odger waypoint when Trophy Fishes are in the inventory and no lava rod in hand.")
- @ConfigEditorBoolean
- @ConfigAccordionId(id = 0)
- @FeatureToggle
- public boolean odgerLocation = true;
+ @Expose
+ @ConfigOption(name = "Odger Waypoint", desc = "Show the Odger waypoint when Trophy Fishes are in the inventory and no lava rod in hand.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean odgerLocation = true;
+ }
@ConfigOption(name = "Thunder Spark", desc = "")
@ConfigEditorAccordion(id = 1)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt
index 4202d2600..2e7439cbf 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.fishing.trophy
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
@@ -8,13 +9,14 @@ import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzColor
-import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class OdgerWaypoint {
+ private val config get() = SkyHanniMod.feature.fishing.trophyFishing
private val location = LorenzVec(-373, 207, -808)
private var hasLavaRodInHand = false
@@ -50,6 +52,10 @@ class OdgerWaypoint {
event.drawDynamicText(location, "Odger", 1.5)
}
- fun isEnabled() = LorenzUtils.inSkyBlock && SkyHanniMod.feature.fishing.odgerLocation &&
- LorenzUtils.skyBlockIsland == IslandType.CRIMSON_ISLE
+ @SubscribeEvent
+ fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
+ event.move(2, "fishing.odgerLocation", "fishing.trophyFishing.odgerLocation")
+ }
+
+ fun isEnabled() = IslandType.CRIMSON_ISLE.isInIsland() && config.odgerLocation
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt
index edb9d9fd1..2c0d78c7b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.fishing.trophy
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old
import at.hannibal2.skyhanni.utils.LorenzUtils
@@ -29,6 +30,11 @@ class TrophyFishFillet {
event.toolTip.add("§7Fillet: §8${filletValue.addSeparators()} Magmafish §7(§6${NumberUtil.format(filletPrice)}§7)")
}
- private fun isEnabled() = LorenzUtils.inSkyBlock && SkyHanniMod.feature.fishing.trophyFilletTooltip
+ @SubscribeEvent
+ fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
+ event.move(2, "fishing.trophyFilletTooltip", "fishing.trophyFishing.filletTooltip")
+ }
+
+ private fun isEnabled() = LorenzUtils.inSkyBlock && SkyHanniMod.feature.fishing.trophyFishing.filletTooltip
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt
index 4a0b6080e..e6087a5b5 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.fishing.trophy
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager.Companion.fishes
import at.hannibal2.skyhanni.utils.LorenzUtils
@@ -16,7 +17,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class TrophyFishMessages {
private val trophyFishPattern =
Regex("§6§lTROPHY FISH! §r§bYou caught an? §r(?<displayName>§[0-9a-f](?:§k)?[\\w -]+)§r§r§r §r§l§r(?<displayRarity>§[0-9a-f]§l\\w+)§r§b\\.")
- private val config get() = SkyHanniMod.feature.fishing
+ private val config get() = SkyHanniMod.feature.fishing.trophyFishing.chatMessages
@SubscribeEvent
fun onStatusBar(event: LorenzChatEvent) {
@@ -36,21 +37,21 @@ class TrophyFishMessages {
val amount = trophyFishCounts.addOrPut(rarity, 1)
event.blockedReason = "trophy_fish"
- if (config.trophyCounter && config.trophyDesign == 0 && amount == 1) {
+ if (config.enabled && config.design == 0 && amount == 1) {
LorenzUtils.chat("§6§lTROPHY FISH! §c§lFIRST §r$displayRarity $displayName")
return
}
- if (config.trophyFishBronzeHider && rarity == TrophyRarity.BRONZE && amount != 1) return
- if (config.trophyFishSilverHider && rarity == TrophyRarity.SILVER && amount != 1) return
- val totalText = if (config.trophyFishTotalAmount) {
+ if (config.bronzeHider && rarity == TrophyRarity.BRONZE && amount != 1) return
+ if (config.silverHider && rarity == TrophyRarity.SILVER && amount != 1) return
+ val totalText = if (config.totalAmount) {
val total = trophyFishCounts.sumAllValues()
" §7(${total.addSeparators()}. total)"
} else ""
val component = ChatComponentText(
- if (config.trophyCounter) {
- "§6§lTROPHY FISH! " + when (config.trophyDesign) {
+ if (config.enabled) {
+ "§6§lTROPHY FISH! " + when (config.design) {
0 -> "§7$amount. §r$displayRarity $displayName$totalText"
1 -> "§bYou caught a $displayName $displayRarity§b. §7(${amount.addSeparators()})$totalText"
else -> "§bYou caught your ${amount.addSeparators()}${amount.ordinal()} $displayRarity $displayName§b.$totalText"
@@ -58,14 +59,25 @@ class TrophyFishMessages {
} else event.message
)
- if (config.trophyFishTooltip) {
+ if (config.tooltip) {
TrophyFishManager.getInfo(internalName)?.let {
component.chatStyle = it.getTooltip(trophyFishCounts)
}
}
Minecraft.getMinecraft().ingameGUI.chatGUI.printChatMessageWithOptionalDeletion(
- component, if (config.trophyFishDuplicateHider) (internalName + rarity).hashCode() else 0
+ component, if (config.duplicateHider) (internalName + rarity).hashCode() else 0
)
}
+
+ @SubscribeEvent
+ fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
+ event.move(2, "fishing.trophyCounter", "fishing.trophyFishing.chatMessages.enabled")
+ event.move(2, "fishing.trophyDesign", "fishing.trophyFishing.chatMessages.design")
+ event.move(2, "fishing.trophyFishTotalAmount", "fishing.trophyFishing.chatMessages.totalAmount")
+ event.move(2, "fishing.trophyFishTooltip", "fishing.trophyFishing.chatMessages.tooltip")
+ event.move(2, "fishing.trophyFishDuplicateHider", "fishing.trophyFishing.chatMessages.duplicateHider")
+ event.move(2, "fishing.trophyFishBronzeHider", "fishing.trophyFishing.chatMessages.bronzeHider")
+ event.move(2, "fishing.trophyFishSilverHider", "fishing.trophyFishing.chatMessages.silverHider")
+ }
}