From c52a71ee63c633d17d7a935c0aa92ddda904c750 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 22 Jun 2024 09:20:18 +0200 Subject: do not use Supplier --- .../skyhanni/features/gui/customscoreboard/ScoreboardElements.kt | 5 ++--- .../skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/gui') 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 6249ac295..116cecd19 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 @@ -46,7 +46,6 @@ import at.hannibal2.skyhanni.utils.TabListData import at.hannibal2.skyhanni.utils.TimeLimitedSet import at.hannibal2.skyhanni.utils.TimeUtils.format import at.hannibal2.skyhanni.utils.TimeUtils.formatted -import java.util.function.Supplier import kotlin.time.Duration.Companion.seconds internal var confirmedUnknownLines = listOf() @@ -75,7 +74,7 @@ private fun onRemoval(line: String) { internal var amountOfUnknownLines = 0 enum class ScoreboardElement( - private val displayPair: Supplier>, + private val displayPair: () -> List, val showWhen: () -> Boolean, private val configLine: String, ) { @@ -285,7 +284,7 @@ enum class ScoreboardElement( private fun getPair(): List { return try { - displayPair.get() + displayPair() } catch (e: NoSuchElementException) { listOf("" to HorizontalAlignment.LEFT) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt index d8fdf532b..ebeed5eee 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt @@ -5,7 +5,6 @@ import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.features.dungeon.DungeonAPI import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.eventsConfig -import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardEvents.NEW_YEAR import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardEvents.VOTING import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern import at.hannibal2.skyhanni.features.misc.ServerRestartTitle @@ -19,7 +18,6 @@ import at.hannibal2.skyhanni.utils.RegexUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.StringUtils.removeResets import at.hannibal2.skyhanni.utils.TabListData -import java.util.function.Supplier import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern as SbPattern /** @@ -35,7 +33,7 @@ private fun getSbLines(): List { } enum class ScoreboardEvents( - private val displayLine: Supplier>, + private val displayLine: () -> List, private val showWhen: () -> Boolean, private val configLine: String, ) { @@ -193,7 +191,7 @@ enum class ScoreboardEvents( override fun toString() = configLine - fun getLines(): List = displayLine.get() + fun getLines(): List = displayLine() companion object { fun getEvent() = buildList { -- cgit