diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-06-09 11:51:53 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-06-09 11:51:53 +0200 |
commit | a997bc86e42c7efa97a2e628aeca4e688d7b55ca (patch) | |
tree | 99b1517ad310627e1fe44b17c7393548bc0c6791 /src/main/java/at/hannibal2 | |
parent | 72fbd51e2a87d6d70c3f576759c5cc07c280be0d (diff) | |
download | skyhanni-a997bc86e42c7efa97a2e628aeca4e688d7b55ca.tar.gz skyhanni-a997bc86e42c7efa97a2e628aeca4e688d7b55ca.tar.bz2 skyhanni-a997bc86e42c7efa97a2e628aeca4e688d7b55ca.zip |
code cleanup
Diffstat (limited to 'src/main/java/at/hannibal2')
4 files changed, 10 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt index 0077a1dac..c7c8925c7 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt @@ -53,7 +53,7 @@ object BitsAPI { profileStorage?.boosterCookieExpiryTime = value } - private const val defaultcookiebits = 4800 + private const val defaultCookieBits = 4800 private val bitsDataGroup = RepoPattern.group("data.bits") @@ -194,7 +194,7 @@ object BitsAPI { } boosterCookieAte.matchMatcher(message) { - bitsAvailable += (defaultcookiebits * (currentFameRank?.bitsMultiplier ?: return)).toInt() + bitsAvailable += (defaultCookieBits * (currentFameRank?.bitsMultiplier ?: return)).toInt() val cookieTime = cookieBuffTime cookieBuffTime = if (cookieTime == null) SimpleTimeMark.now() + 4.days else cookieTime + 4.days sendBitsAvailableGainedEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt index fed11dac0..c707e2209 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt @@ -73,8 +73,9 @@ object CityProjectFeatures { if (LorenzUtils.skyBlockArea == "Community Center") return - if (playerSpecific.nextCityProjectParticipationTime.isFarPast()) return - if (playerSpecific.nextCityProjectParticipationTime.isInFuture()) return + playerSpecific.nextCityProjectParticipationTime.let { + if (it.isFarPast() || it.isInFuture()) return + } if (lastReminderSend.passedSince() < 30.seconds) return lastReminderSend = SimpleTimeMark.now() diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateAmount.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateAmount.kt index 00e8870d2..7f0694e2a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateAmount.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateAmount.kt @@ -5,7 +5,6 @@ import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.TimeUtils.format import kotlin.time.Duration -import kotlin.time.Duration.Companion.seconds enum class ChocolateAmount(val chocolate: () -> Long) { CURRENT({ profileStorage?.currentChocolate ?: 0 }), @@ -26,8 +25,8 @@ enum class ChocolateAmount(val chocolate: () -> Long) { fun timeUntilGoal(goal: Long): Duration { val profileStorage = profileStorage ?: return Duration.ZERO - val updatedAgo = profileStorage.lastDataSave.passedSince().inWholeSeconds - return ChocolateFactoryAPI.timeUntilNeed(goal - chocolate()) - updatedAgo.seconds + val updatedAgo = profileStorage.lastDataSave.passedSince() + return ChocolateFactoryAPI.timeUntilNeed(goal - chocolate()) - updatedAgo } companion object { diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt index 4d4fdf068..15af541d0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt @@ -44,7 +44,7 @@ object ChocolateFactoryTimeTowerManager { if (nextCharge.isInPast() && !nextCharge.isFarPast() && currentCharges() < maxCharges()) { profileStorage.currentTimeTowerUses++ - val nextTimeTower = profileStorage.nextTimeTower + (profileStorage.timeTowerCooldown).hours + val nextTimeTower = profileStorage.nextTimeTower + profileStorage.timeTowerCooldown.hours profileStorage.nextTimeTower = nextTimeTower if (!config.timeTowerWarning) return @@ -103,9 +103,7 @@ object ChocolateFactoryTimeTowerManager { return endTime > currentTime } - private fun timeTowerEnds(): SimpleTimeMark { - return profileStorage?.currentTimeTowerEnds ?: SimpleTimeMark.farPast() - } + private fun timeTowerEnds(): SimpleTimeMark = profileStorage?.currentTimeTowerEnds ?: SimpleTimeMark.farPast() private fun timeTowerReminder() { if (lastTimeTowerReminder.passedSince() < 20.seconds) return @@ -139,8 +137,7 @@ object ChocolateFactoryTimeTowerManager { val currentTime = profileStorage?.lastDataSave ?: SimpleTimeMark.farPast() val endTime = profileStorage?.currentTimeTowerEnds ?: SimpleTimeMark.farPast() - val duration = endTime - currentTime - return duration + return endTime - currentTime } @SubscribeEvent |