diff options
author | appable <enzospiacitelli@gmail.com> | 2023-08-07 03:01:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-07 12:01:49 +0200 |
commit | 59919faeaece5152ee6f7a4402155698f3f6292d (patch) | |
tree | 6f86761a98a4bb63770c161cf58bd6ba86763948 /src/main/java/at/hannibal2 | |
parent | 65e79034527bd2f967a8c580681534435280d5f1 (diff) | |
download | skyhanni-59919faeaece5152ee6f7a4402155698f3f6292d.tar.gz skyhanni-59919faeaece5152ee6f7a4402155698f3f6292d.tar.bz2 skyhanni-59919faeaece5152ee6f7a4402155698f3f6292d.zip |
Merge pull request #365
* compact double hook messages
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java | 5 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt | 38 |
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 |