summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorCarsCupcake <84076092+CarsCupcake@users.noreply.github.com>2024-02-19 15:50:11 +0100
committerGitHub <noreply@github.com>2024-02-19 15:50:11 +0100
commitb065fc1113977529831be5eab587c1612efdde79 (patch)
tree545e04c7c76f9f3933a5451d3a5b0f16f3863189 /src/main/java/at/hannibal2/skyhanni/features
parent96c657cbb5e1c9282911bb8b7b6f6239392ae07f (diff)
downloadskyhanni-b065fc1113977529831be5eab587c1612efdde79.tar.gz
skyhanni-b065fc1113977529831be5eab587c1612efdde79.tar.bz2
skyhanni-b065fc1113977529831be5eab587c1612efdde79.zip
Low Quiver Notification. #880
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/QuiverNotification.kt23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/QuiverNotification.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/QuiverNotification.kt
new file mode 100644
index 000000000..40e51c226
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/QuiverNotification.kt
@@ -0,0 +1,23 @@
+package at.hannibal2.skyhanni.features.inventory
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.TitleManager
+import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.utils.SoundUtils
+import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
+import at.hannibal2.skyhanni.utils.StringUtils.removeColor
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import kotlin.time.Duration.Companion.seconds
+
+object QuiverNotification {
+ private val quiverChatPattern by RepoPattern.pattern("inventory.quiver.chat.low", "§cYou only have (?<arrowsLeft>.*) arrows left in your Quiver!")
+ @SubscribeEvent
+ fun onChatMessage(event: LorenzChatEvent) {
+ if (!SkyHanniMod.configManager.features.inventory.quiverAlert) return
+ quiverChatPattern.matchMatcher(event.message) {
+ TitleManager.sendTitle("§c${group("arrowsLeft")} arrows left!", 3.seconds, 3.6, 7f)
+ SoundUtils.repeatSound(100, 30, SoundUtils.plingSound)
+ }
+ }
+}