aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorJ10a1n15 <45315647+j10a1n15@users.noreply.github.com>2024-04-18 20:13:35 +0200
committerGitHub <noreply@github.com>2024-04-18 20:13:35 +0200
commit602940752c3a74473c8092b3d646926686b38522 (patch)
tree1489e71f5efde963741358bd0285c5b90d3afb8d /src/main/java/at/hannibal2/skyhanni/features
parent04ce843b12afe771fba6e03b3cd39a806a81cbd5 (diff)
downloadskyhanni-602940752c3a74473c8092b3d646926686b38522.tar.gz
skyhanni-602940752c3a74473c8092b3d646926686b38522.tar.bz2
skyhanni-602940752c3a74473c8092b3d646926686b38522.zip
Feature: Bits Gained Chat Message (#1487)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/NoBitsWarning.kt18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NoBitsWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NoBitsWarning.kt
index 2529c026b..350e95384 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/NoBitsWarning.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NoBitsWarning.kt
@@ -5,18 +5,25 @@ import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.BitsUpdateEvent
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.SoundUtils
import at.hannibal2.skyhanni.utils.SoundUtils.createSound
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.seconds
-class NoBitsWarning {
+object NoBitsWarning {
- private val config get() = SkyHanniMod.feature.misc.noBitsWarning
+ private val config get() = SkyHanniMod.feature.misc.bits
+
+ fun sendBitsGainChatMessage(bits: Int) {
+ if (!isChatMessageEnabled()) return
+ if (bits < config.threshold) return
+ ChatUtils.chat("You have gained §b${bits.addSeparators()} §eBits.")
+ }
@SubscribeEvent
fun onBitsGain(event: BitsUpdateEvent.BitsGain) {
- if (!isEnabled()) return
+ if (!isWarningEnabled()) return
if (event.bitsAvailable != 0) return
ChatUtils.clickableChat(
@@ -30,7 +37,10 @@ class NoBitsWarning {
@SubscribeEvent
fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
event.move(35, "misc.noBitsWarning", "misc.noBitsWarning.enabled")
+ event.move(40, "misc.noBitsWarning.enabled", "misc.bits.enableWarning")
+ event.move(40, "misc.noBitsWarning.notificationSound", "misc.bits.notificationSound")
}
- private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled
+ private fun isChatMessageEnabled() = LorenzUtils.inSkyBlock && config.bitsGainChatMessage
+ private fun isWarningEnabled() = LorenzUtils.inSkyBlock && config.enableWarning
}