aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt38
2 files changed, 40 insertions, 3 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 b5018173c..8041e4234 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java
@@ -188,4 +188,9 @@ public class FishingConfig {
@ConfigOption(name = "Shorten Fishing Message", desc = "Shortens the chat message that says what type of sea creature you have fished.")
@ConfigEditorBoolean
public boolean shortenFishingMessage = false;
+
+ @Expose
+ @ConfigOption(name = "Compact Double Hook Message", desc = "Adds Double Hook to the sea creature chat message instead of in a previous line.")
+ @ConfigEditorBoolean
+ public boolean compactDoubleHook = false;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt
index 2c310a7bd..9f3c10b6d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt
@@ -1,21 +1,53 @@
package at.hannibal2.skyhanni.features.fishing
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.ChatManager
+import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.SeaCreatureFishEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
+import net.minecraft.util.IChatComponent
+import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class SeaCreatureMessageShortener {
+ private var nextIsDoubleHook: Boolean = false
+
+ private val config get() = SkyHanniMod.feature.fishing
+
+ @SubscribeEvent(priority = EventPriority.LOW)
+ fun onChatMessage(event: LorenzChatEvent) {
+ if (!LorenzUtils.inSkyBlock) return
+ if (doubleHookMessages.contains(event.message)) {
+ event.blockedReason = "double_hook"
+ nextIsDoubleHook = true
+ }
+ }
@SubscribeEvent
fun onSeaCreatureFish(event: SeaCreatureFishEvent) {
- if (!SkyHanniMod.feature.fishing.shortenFishingMessage) return
-
+ if (!config.shortenFishingMessage && !config.compactDoubleHook) return
val seaCreature = event.seaCreature
event.chatEvent.blockedReason = "sea_creature_caught"
- LorenzUtils.chat("§9You caught a $seaCreature§9!")
+
+ var message = if (config.shortenFishingMessage) {
+ "§9You caught a $seaCreature§9!"
+ } else event.chatEvent.message
+
+ if (config.compactDoubleHook && nextIsDoubleHook) {
+ nextIsDoubleHook = false
+ message = "§e§lDOUBLE HOOK! $message"
+ }
+ LorenzUtils.chat(message)
+
if (seaCreature.fishingExperience == 0) {
LorenzUtils.debug("no fishing exp set for " + seaCreature.displayName)
}
}
+
+ companion object {
+ private val doubleHookMessages = setOf(
+ "§eIt's a §r§aDouble Hook§r§e! Woot woot!",
+ "§eIt's a §r§aDouble Hook§r§e!"
+ )
+ }
} \ No newline at end of file