diff options
author | J10a1n15 <45315647+j10a1n15@users.noreply.github.com> | 2024-04-21 23:00:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-21 23:00:12 +0200 |
commit | 2c448cf20f20936c3d4c83ff29c0bf043fe6394f (patch) | |
tree | 305134f64853ccf31e9718e7110d936cc16402c8 /src/main/java/at/hannibal2/skyhanni/data | |
parent | f978de08fe03fe1808e611ea75bf14cbae904d44 (diff) | |
download | skyhanni-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/data')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt index d400959c0..c580e00d5 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt @@ -7,7 +7,6 @@ import at.hannibal2.skyhanni.events.BitsUpdateEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.ScoreboardChangeEvent -import at.hannibal2.skyhanni.features.misc.NoBitsWarning.sendBitsGainChatMessage import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -153,10 +152,10 @@ object BitsAPI { if (amount == bits) return if (amount > bits) { - bitsAvailable -= amount - bits - sendBitsGainChatMessage(amount - bits) + val difference = amount - bits + bitsAvailable -= difference bits = amount - sendBitsGainEvent() + sendBitsGainEvent(difference) } else { bits = amount sendBitsSpentEvent() @@ -228,7 +227,6 @@ object BitsAPI { val difference = bits - bitsAvailable if (difference > 0) { - sendBitsGainChatMessage(difference) bits += difference } } @@ -308,7 +306,7 @@ object BitsAPI { fun hasCookieBuff() = cookieBuffTime?.isInFuture() ?: false - private fun sendBitsGainEvent() = BitsUpdateEvent.BitsGain(bits, bitsAvailable).postAndCatch() + private fun sendBitsGainEvent(difference: Int) = BitsUpdateEvent.BitsGain(bits, bitsAvailable, difference).postAndCatch() private fun sendBitsSpentEvent() = BitsUpdateEvent.BitsSpent(bits, bitsAvailable).postAndCatch() private fun sendBitsAvailableGainedEvent() = BitsUpdateEvent.BitsAvailableGained(bits, bitsAvailable).postAndCatch() |