Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com>
  • Loading branch information
j10a1n15 committed Jun 11, 2024
1 parent 5d48495 commit b7304d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardEvents.VOTI
import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern
import at.hannibal2.skyhanni.features.misc.ServerRestartTitle
import at.hannibal2.skyhanni.features.rift.area.stillgorechateau.RiftBloodEffigies
import at.hannibal2.skyhanni.utils.CollectionUtils.addIfNotNull
import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter
import at.hannibal2.skyhanni.utils.LorenzUtils.inAdvancedMiningIsland
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
Expand Down Expand Up @@ -536,8 +535,6 @@ private fun getRedstoneLines(): List<String> = listOf(getSbLines().first { SbPat

private fun getRedstoneShowWhen(): Boolean = SbPattern.redstonePattern.anyMatches(getSbLines())

private fun getAnniversaryLines() = buildList {
addIfNotNull(getSbLines().firstOrNull { SbPattern.anniversaryPattern.matches(it) })
}
private fun getAnniversaryLines() = listOf(getSbLines().first { SbPattern.anniversaryPattern.matches(it) })

private fun getAnniversaryShowWhen(): Boolean = SbPattern.anniversaryPattern.anyMatches(getSbLines())
3 changes: 3 additions & 0 deletions src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ object CollectionUtils {
return newList
}

/**
* This does not work inside a [buildList] block
*/
fun List<String>.addIfNotNull(element: String?) = element?.let { plus(it) } ?: this

fun <K, V> Map<K, V>.editCopy(function: MutableMap<K, V>.() -> Unit) =
Expand Down

0 comments on commit b7304d2

Please sign in to comment.