Skip to content

Commit

Permalink
Added voting lines
Browse files Browse the repository at this point in the history
  • Loading branch information
j10a1n15 committed Dec 8, 2023
1 parent 93986db commit bfcf6ed
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,26 @@ import java.util.function.Supplier
private val config get() = SkyHanniMod.feature.gui.customScoreboard

enum class Events(private val displayLine: Supplier<List<String>>, private val showWhen: () -> Boolean) {
VOTING(
{
val list = mutableListOf<String>()

list += ScoreboardData.sidebarLinesFormatted.firstOrNull { it.startsWith("§6Year ") && it.endsWith(" Votes") } ?: "<hidden>"
if (ScoreboardData.sidebarLinesFormatted.nextAfter(list[0]) == "§7Waiting for") {
list += "§7Waiting for"
list += "§7your vote..."
} else {
for (i in 1 until 6) {
list += ScoreboardData.sidebarLinesFormatted.nextAfter(list[0], i) ?: "<hidden>"
}
}

list
},
{
ScoreboardData.sidebarLinesFormatted.any { it.startsWith("§6Year ") && it.endsWith(" Votes") }
}
),
SERVER_CLOSE(
{
listOf(ScoreboardData.sidebarLinesFormatted.firstOrNull { it.startsWith("§cServer closing: ") }
Expand Down Expand Up @@ -189,7 +209,7 @@ enum class Events(private val displayLine: Supplier<List<String>>, private val s
ScoreboardData.sidebarLinesFormatted.any { it.startsWith("Flight Duration:") }
}
),
WINTER( // not tested
WINTER(
{
val list = mutableListOf<String>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ class InformationGetter {
"Points: ",
"Challenge:",
*dungeonClassList.toTypedArray(),
"§cLocked"
"§cLocked",
"§fCleanup§7:",
"§6Year ",
"§7Waiting for",
"§7your vote..."
)

extraLines = sidebarLines.filter { line -> !knownLines.any { line.trim().contains(it) } }
Expand All @@ -172,5 +176,11 @@ class InformationGetter {
// Remove slayer
extraLines = extraLines.filter { sidebarLines.nextAfter("Slayer Quest", 1) != it }
extraLines = extraLines.filter { sidebarLines.nextAfter("Slayer Quest", 2) != it }

// remove voting lines
val votedLine = sidebarLines.firstOrNull { it.startsWith("§6Year ") } ?: "§6Year "
for (i in 1 until 6) {
extraLines = extraLines.filter { sidebarLines.nextAfter(votedLine, i) != it }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ enum class ScoreboardElements(
),
ISLAND(
{
listOf("§7㋖ §a" + HypixelData.skyBlockIsland.toString().split("_").joinToString(" ") { it.firstLetterUppercase() } to AlignmentEnum.LEFT)
listOf(
"§7㋖ §a" + HypixelData.skyBlockIsland.toString().split("_")
.joinToString(" ") { it.firstLetterUppercase() } to AlignmentEnum.LEFT)
},
{
true
Expand Down Expand Up @@ -416,7 +418,10 @@ enum class ScoreboardElements(
listOf("§cUndetected Lines:" to AlignmentEnum.LEFT) + extraLines.map { it to AlignmentEnum.LEFT }
},
{
extraLines.isNotEmpty()
if (extraLines.isNotEmpty()) {
amountOfExtraLines = 0
}
false
},
"§7Extra lines the mod is not detecting"
),
Expand Down

0 comments on commit bfcf6ed

Please sign in to comment.