diff options
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() |