aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyFishMessages.kt46
2 files changed, 31 insertions, 21 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java b/src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java
index 52065e37b..46173740a 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java
@@ -26,6 +26,12 @@ public class Fishing {
public boolean trophyFishBronzeHider = false;
@Expose
+ @ConfigOption(name = "Hide Silver Duplicates", desc = "Hide duplicate messages for silver trophy fishes from chat.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
+ public boolean trophyFishSilverHider = false;
+
+ @Expose
@ConfigOption(name = "Shorten Fishing Message", desc = "Shorten the message what type of sea creature you have fished.")
@ConfigEditorBoolean
public boolean shortenFishingMessage = false;
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyFishMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyFishMessages.kt
index 2bf5bb2ce..080fa89c4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyFishMessages.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyFishMessages.kt
@@ -45,29 +45,33 @@ class TrophyFishMessages {
val message = event.message
//TODO replace logic with regex
- if (message.startsWith("§6§lTROPHY FISH! §r§bYou caught a")) {
- var displayName =
- if (message.contains(" a §r")) message.between(" a §r", "§r §r") else message.between(" an §r", "§r §r")
- if (displayName.contains("§k")) {
- displayName = displayName.replace("§k", "")
- displayName = displayName.replace("Obfuscated", "Obfuscated Fish")
- }
- val rarity = message.between("§r §r", "§b.").lowercase().replace("§l", "")
+ if (!message.startsWith("§6§lTROPHY FISH! §r§bYou caught a")) return
- val name = (rarity + "_" + displayName).removeColor().lowercase().replace(" ", "").replace("-", "")
- val amount = map.getOrDefault(name, 0) + 1
- map[name] = amount
- event.blockedReason = "trophy_fish"
+ var displayName =
+ if (message.contains(" a §r")) message.between(" a §r", "§r §r") else message.between(" an §r", "§r §r")
+ if (displayName.contains("§k")) {
+ displayName = displayName.replace("§k", "")
+ displayName = displayName.replace("Obfuscated", "Obfuscated Fish")
+ }
+ val rarity = message.between("§r §r", "§b.").lowercase().replace("§l", "")
- if (amount == 1) {
- LorenzUtils.chat("§6TROPHY FISH! §c§lFIRST §r$rarity $displayName")
- } else {
- if (rarity.contains("bronze")) {
- if (SkyHanniMod.feature.fishing.trophyFishBronzeHider) return
- }
- LorenzUtils.chat("§6TROPHY FISH! §7$amount. §r$rarity $displayName")
- }
-// LorenzDebug.log("new trophy: $name = $amount")
+ val name = (rarity + "_" + displayName).removeColor().lowercase().replace(" ", "").replace("-", "")
+ val amount = map.getOrDefault(name, 0) + 1
+ map[name] = amount
+ event.blockedReason = "trophy_fish"
+
+ if (amount == 1) {
+ LorenzUtils.chat("§6TROPHY FISH! §c§lFIRST §r$rarity $displayName")
+ return
}
+
+ if (rarity.contains("bronze")) {
+ if (SkyHanniMod.feature.fishing.trophyFishBronzeHider) return
+ }
+ if (rarity.contains("silver")) {
+ if (SkyHanniMod.feature.fishing.trophyFishSilverHider) return
+ }
+
+ LorenzUtils.chat("§6TROPHY FISH! §7$amount. §r$rarity $displayName")
}
} \ No newline at end of file