aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-01-19 14:35:43 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-01-19 14:35:43 +0100
commit122a9a46aaee07ee8c629384abff7069c2c815e2 (patch)
treed241dd395cec8bc19be29931d147e54438997957 /src/main/java
parent4b7b62f3592e4869c1d224041c28010d3c99be44 (diff)
downloadskyhanni-122a9a46aaee07ee8c629384abff7069c2c815e2.tar.gz
skyhanni-122a9a46aaee07ee8c629384abff7069c2c815e2.tar.bz2
skyhanni-122a9a46aaee07ee8c629384abff7069c2c815e2.zip
Added Hide Silver Duplicates.
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