Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Custom Scoreboard in Kuudra #3006

Open
wants to merge 1 commit into
base: beta
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package at.hannibal2.skyhanni.features.gui.customscoreboard

import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.enums.OutsideSbFeature
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.data.ScoreboardData
import at.hannibal2.skyhanni.events.ConfigLoadEvent
import at.hannibal2.skyhanni.events.DebugDataCollectEvent
Expand Down Expand Up @@ -199,7 +200,7 @@ object CustomScoreboard {

@SubscribeEvent
fun onIslandChange(event: IslandChangeEvent) {
updateIslandEntries()
if (event.newIsland != IslandType.NONE) updateIslandEntries()
}

private fun updateIslandEntries() {
Expand All @@ -215,10 +216,10 @@ object CustomScoreboard {
add("Custom Scoreboard disabled.")
} else {
add("Custom Scoreboard Lines:")
addAll(formatEntriesDebug(config.scoreboardEntries.get().map { it.name to it.element }))
addAll(formatEntriesDebug(config.scoreboardEntries.get().map { it.name to it.element }, currentIslandEntries))

add("Custom Scoreboard Events:")
addAll(formatEntriesDebug(eventsConfig.eventEntries.get().map { it.name to it.event }))
addAll(formatEntriesDebug(eventsConfig.eventEntries.get().map { it.name to it.event }, currentIslandEvents))

allUnknownLines.takeIfNotEmpty()?.let { set ->
add("Recent Unknown Lines:")
Expand All @@ -228,13 +229,15 @@ object CustomScoreboard {
}
}

private fun formatEntriesDebug(entries: List<Pair<String, ScoreboardElement>>) = entries.map { (name, element) ->
val lines = element.getLines().takeIf { it.isNotEmpty() }?.joinToString(", ") { it.display } ?: "No lines to display"
" ${name.firstLetterUppercase()} - " +
"island: ${element.showIsland()} - " +
"show: ${element.showWhen()} - " +
lines
}
private fun formatEntriesDebug(entries: List<Pair<String, ScoreboardElement>>, currentIslandList: List<ScoreboardElement>) =
entries.map { (name, element) ->
val lines = element.getLines().takeIf { it.isNotEmpty() }?.joinToString(", ") { it.display } ?: "No lines to display"
" ${name.firstLetterUppercase()} - " +
"island: ${element.showIsland()} - " +
"in Island: ${element in currentIslandList} - " +
"show: ${element.showWhen()} - " +
lines
}

@JvmStatic
fun resetAppearance() {
Expand Down
Loading