From dc391b540873a9e34d3f9bb75b7b9e84690357e2 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Tue, 19 Mar 2024 10:15:03 +0100 Subject: Improvement + Fix: Custom Scoreboard Fixes Part 4 (#1212) --- src/main/java/at/hannibal2/skyhanni/data/MaxwellAPI.kt | 6 +++--- .../features/gui/customscoreboard/CustomScoreboard.kt | 13 ++++++------- .../features/gui/customscoreboard/ScoreboardEvents.kt | 12 ------------ .../features/gui/customscoreboard/ScoreboardPattern.kt | 2 +- .../features/gui/customscoreboard/UnknownLinesHandler.kt | 1 + 5 files changed, 11 insertions(+), 23 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni') diff --git a/src/main/java/at/hannibal2/skyhanni/data/MaxwellAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/MaxwellAPI.kt index 98c410b86..e584efd80 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MaxwellAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MaxwellAPI.kt @@ -125,13 +125,13 @@ object MaxwellAPI { if (tunings?.isNotEmpty() == true) { val tuningsInScoreboard = ScoreboardElement.TUNING in CustomScoreboard.config.scoreboardEntries if (tuningsInScoreboard) { - ChatUtils.chat("Talk to Maxwell again to update the tuning data in scoreboard.") + ChatUtils.chat("Talk to Maxwell and open the Tuning Page again to update the tuning data in scoreboard.") } } } } - // load earler, so that other features can already use the api in this event + // load earlier, so that other features can already use the api in this event @SubscribeEvent(priority = EventPriority.HIGH) fun onInventoryFullyLoaded(event: InventoryOpenEvent) { if (!isEnabled()) return @@ -200,7 +200,7 @@ object MaxwellAPI { private fun loadThaumaturgyTunings(inventoryItems: Map) { val tunings = tunings ?: return - // Only load those rounded values if we dont have any valurs at all + // Only load those rounded values if we dont have any values at all if (tunings.isNotEmpty()) return val item = inventoryItems[51] ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt index 1ee86cdb7..933c4d47e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt @@ -9,11 +9,9 @@ // - countdown events like fishing festival + fiesta when its not on tablist // - CookieAPI https://discord.com/channels/997079228510117908/1162844830360146080/1195695210433351821 // - Rng meter display -// - shorten time till next mayor https://discord.com/channels/997079228510117908/1162844830360146080/1216440046320746596 // - option to hide coins earned // - color options in the purse etc lines // - choose the amount of decimal places in shorten nums -// - ~~very important bug fix: duplex is weird :(~~ will be fixed with empas quiverapi overhaul // - more anchor points (alignment enums in renderutils) // @@ -99,28 +97,29 @@ class CustomScoreboard { private fun createLines() = buildList { for (element in config.scoreboardEntries) { - val line = element.getVisiblePair() + val lines = element.getVisiblePair() + if (lines.isEmpty()) continue // Hide consecutive empty lines if ( informationFilteringConfig.hideConsecutiveEmptyLines && - line.isNotEmpty() && line[0].first == "" && lastOrNull()?.first?.isEmpty() == true + lines.isNotEmpty() && lines[0].first == "" && lastOrNull()?.first?.isEmpty() == true ) { continue } // Adds empty lines - if (line[0].first == "") { + if (lines[0].first == "") { add("" to HorizontalAlignment.LEFT) continue } // Does not display this line - if (line.any { it.first == "" }) { + if (lines.any { it.first == "" }) { continue } - addAll(line) + addAll(lines) } } 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 636433ccc..21ec0d036 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 @@ -92,10 +92,6 @@ enum class ScoreboardEvents(private val displayLine: Supplier>, pri ::getBroodmotherLines, ::getBroodmotherShowWhen ), - NEW_YEAR( - ::getNewYearLines, - ::getNewYearShowWhen - ), ORINGO( ::getOringoLines, ::getOringoShowWhen @@ -370,14 +366,6 @@ private fun getBroodmotherShowWhen(): Boolean { return getSbLines().any { SbPattern.broodmotherPattern.matches(it) } } -private fun getNewYearLines(): List { - return listOf(getSbLines().first { SbPattern.newYearPattern.matches(it) }) -} - -private fun getNewYearShowWhen(): Boolean { - return getSbLines().any { SbPattern.newYearPattern.matches(it) } -} - private fun getOringoLines(): List { return listOf(getSbLines().first { SbPattern.travelingZooPattern.matches(it) }) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt index b515fe37b..b4f946523 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt @@ -283,7 +283,7 @@ object ScoreboardPattern { ) val brokenRedstonePattern by miscSb.pattern( "brokenredstone", - "\\s*e: §e§b\\d{1,3}%$" + "\\s*(?:(?:§.)*⚡ (§.)*Redston|e: (?:§.)*\\d+%)\\s*" ) val redstonePattern by miscSb.pattern( "redstone", diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt index b89a7b86c..6261e9c81 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt @@ -41,6 +41,7 @@ object UnknownLinesHandler { SbPattern.autoClosingPattern, SbPattern.startingInPattern, SbPattern.timeElapsedPattern, + SbPattern.instanceShutdownPattern, SbPattern.keysPattern, SbPattern.clearedPattern, SbPattern.soloPattern, -- cgit