diff options
author | Empa <42304516+ItsEmpa@users.noreply.github.com> | 2024-04-05 19:23:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-05 19:23:49 +0200 |
commit | 56b2f2f8a79caae96557406771203061c360468c (patch) | |
tree | a59269ec811ea78dcf64a819f97650296f3468df /src/main/java/at/hannibal2/skyhanni/features/gui | |
parent | 299aa3799b61ccb5fe3cb8975320d9271d853f38 (diff) | |
download | skyhanni-56b2f2f8a79caae96557406771203061c360468c.tar.gz skyhanni-56b2f2f8a79caae96557406771203061c360468c.tar.bz2 skyhanni-56b2f2f8a79caae96557406771203061c360468c.zip |
Improvement: Cookie Buff Timer (#1292)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/gui')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt | 42 |
1 files changed, 8 insertions, 34 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt index 65d8d880c..1b51110a5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt @@ -33,7 +33,6 @@ import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.percentageColor import at.hannibal2.skyhanni.utils.RenderUtils.HorizontalAlignment import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase -import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.pluralize import at.hannibal2.skyhanni.utils.TabListData @@ -157,7 +156,7 @@ enum class ScoreboardElement( COOKIE( ::getCookieDisplayPair, ::getCookieShowWhen, - "§d§lCookie Buff\n §f3days, 17hours" + "§dCookie Buff§f: 3d 17h" ), EMPTY_LINE2( ::getEmptyLineDisplayPair, @@ -590,41 +589,16 @@ private fun getTuningDisplayPair(): List<Pair<String, HorizontalAlignment>> { private fun getPowerShowWhen() = !inAnyIsland(IslandType.THE_RIFT) -private fun getCookieTime(): String? { - return CustomScoreboardUtils.getTablistFooter().split("\n") - .nextAfter("§d§lCookie Buff") - ?: run { - for (line in TabListData.getTabList()) { - ScoreboardPattern.boosterCookieEffectsWidgetPattern.matchMatcher(line) { - return group("time") - } - } - null - } -} - -private fun getCookieDisplayPair(): List<ScoreboardElementType> { - val timeLine: String = getCookieTime() - ?: return listOf( - "§d§lCookie Buff" to HorizontalAlignment.LEFT, - " §7- §cNot active" to HorizontalAlignment.LEFT - ) - - return listOf( - "§d§lCookie Buff" to HorizontalAlignment.LEFT, - if (ScoreboardPattern.cookieNotActivePattern.matches(timeLine)) - " §7- §cNot active" to HorizontalAlignment.LEFT - else - " §7- §f${timeLine}" to HorizontalAlignment.LEFT - ) -} +private fun getCookieDisplayPair() = listOf( + "§dCookie Buff§f: " + (BitsAPI.cookieBuffTime?.let { + if (!BitsAPI.hasCookieBuff()) "§cNot Active" else it.timeUntil().format(maxUnits = 2) + } + ?: "§cOpen SbMenu!") to HorizontalAlignment.LEFT +) private fun getCookieShowWhen(): Boolean { if (HypixelData.bingo) return false - - return if (informationFilteringConfig.hideEmptyLines) { - getCookieTime() != null - } else true + return informationFilteringConfig.hideEmptyLines && BitsAPI.hasCookieBuff() } private fun getObjectiveDisplayPair() = buildList { |