aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-20 02:12:22 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-20 02:12:22 +0200
commitb6a4614e91c74f748fabae832b8ef1f1b75c4410 (patch)
treea7d97c2e0c252bbb3772527fe7148d8a0338830e /src/main
parent418dc72a39cea34e9398b2c6797107d4b456c34d (diff)
downloadskyhanni-b6a4614e91c74f748fabae832b8ef1f1b75c4410.tar.gz
skyhanni-b6a4614e91c74f748fabae832b8ef1f1b75c4410.tar.bz2
skyhanni-b6a4614e91c74f748fabae832b8ef1f1b75c4410.zip
Showing the total amount of sharks fished after the fishing contest in chat
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt
index 30f95f3e3..4d4ec4455 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt
@@ -2,11 +2,13 @@ package at.hannibal2.skyhanni.features.fishing
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.GuiRenderEvent
+import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.SeaCreatureFishEvent
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.LorenzUtils
+import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
@@ -24,7 +26,7 @@ class SharkFishCounter {
val displayName = event.seaCreature.displayName
if (displayName.contains("Shark")) {
counter++
- display = "$counter sharks caught"
+ display = "§7Sharks caught: §e${counter.addSeparators()}"
}
}
@@ -42,6 +44,24 @@ class SharkFishCounter {
}
}
+ @SubscribeEvent
+ fun onChatMessage(event: LorenzChatEvent) {
+ if (event.message == "§b§lFISHING FESTIVAL §r§eThe festival has concluded! Time to dry off and repair your rods!") {
+ val funnyComment = when {
+ counter == 0 -> return
+ counter < 50 -> "Well done!"
+ counter < 100 -> "Nice!"
+ counter < 150 -> "Really nice!"
+ counter < 200 -> "Super cool!"
+ counter < 250 -> "Mega cool!"
+ counter < 350 -> "Like a pro!"
+ else -> "How???"
+ }
+ LorenzUtils.chat("§e[SkyHanni] You caught ${counter.addSeparators()} sharks during this fishing contest. $funnyComment")
+ counter = 0
+ }
+ }
+
private fun isWaterFishingRod(): Boolean {
val heldItem = InventoryUtils.getItemInHand() ?: return false
val isRod = heldItem.name?.contains("Rod") ?: return false