summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorJ10a1n15 <45315647+j10a1n15@users.noreply.github.com>2024-04-21 23:00:12 +0200
committerGitHub <noreply@github.com>2024-04-21 23:00:12 +0200
commit2c448cf20f20936c3d4c83ff29c0bf043fe6394f (patch)
tree305134f64853ccf31e9718e7110d936cc16402c8 /src/main/java/at/hannibal2/skyhanni/features
parentf978de08fe03fe1808e611ea75bf14cbae904d44 (diff)
downloadskyhanni-2c448cf20f20936c3d4c83ff29c0bf043fe6394f.tar.gz
skyhanni-2c448cf20f20936c3d4c83ff29c0bf043fe6394f.tar.bz2
skyhanni-2c448cf20f20936c3d4c83ff29c0bf043fe6394f.zip
Fix: Fixed Bits Gained Chat Messages randomly being send (#1503)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/NoBitsWarning.kt30
1 files changed, 15 insertions, 15 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 350e95384..fbaba9095 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/NoBitsWarning.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NoBitsWarning.kt
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.features.misc
+import akka.event.NoLogging.isWarningEnabled
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.BitsUpdateEvent
@@ -15,23 +16,22 @@ object 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 (!isWarningEnabled()) return
- if (event.bitsAvailable != 0) return
-
- ChatUtils.clickableChat(
- "§bNo Bits Available! §eClick to run /bz booster cookie.",
- "bz booster cookie"
- )
- LorenzUtils.sendTitle("§bNo Bits Available", 5.seconds)
- if (config.notificationSound) SoundUtils.repeatSound(100, 10, createSound("note.pling", 0.6f))
+ if (isWarningEnabled() && event.bitsAvailable == 0) {
+
+ ChatUtils.clickableChat(
+ "§bNo Bits Available! §eClick to run /bz booster cookie.",
+ "bz booster cookie"
+ )
+ LorenzUtils.sendTitle("§bNo Bits Available", 5.seconds)
+ if (config.notificationSound) SoundUtils.repeatSound(100, 10, createSound("note.pling", 0.6f))
+ }
+
+ if (isChatMessageEnabled()) {
+ if (event.bits < config.threshold) return
+ ChatUtils.chat("You have gained §b${event.difference.addSeparators()} §eBits.")
+ }
}
@SubscribeEvent