diff options
Diffstat (limited to 'src')
6 files changed, 29 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt index b674c382a..be947b18c 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt @@ -12,7 +12,7 @@ import com.google.gson.JsonPrimitive object ConfigUpdaterMigrator { val logger = LorenzLogger("ConfigMigration") - const val CONFIG_VERSION = 49 + const val CONFIG_VERSION = 50 fun JsonElement.at(chain: List<String>, init: Boolean): JsonElement? { if (chain.isEmpty()) return this if (this !is JsonObject) return null 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 f0601c557..31a3b31c8 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 @@ -262,6 +262,11 @@ object CustomScoreboard { newArray } + event.transform(50, "$displayPrefix.events.eventEntries") { element -> + val array = element.asJsonArray + array.add(JsonPrimitive(ScoreboardEvents.ANNIVERSARY.name)) + array + } event.move(43, "$displayPrefix.alignment.alignRight", "$displayPrefix.alignment.horizontalAlignment") { JsonPrimitive( 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 f8e7313d1..e0cbaff28 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 @@ -173,6 +173,11 @@ enum class ScoreboardEvents( ::getRedstoneShowWhen, "§e§l⚡ §cRedstone: §e§b7%" ), + ANNIVERSARY( + ::getAnniversaryLines, + ::getAnniversaryShowWhen, + "§d5th Anniversary§f 167:59:54", + ), ; override fun toString() = configLine @@ -390,7 +395,7 @@ private fun getActiveEventLine(): List<String> { // Some Active Events are better not shown from the tablist, // but from other locations like the scoreboard - val blockedEvents = listOf("Spooky Festival") + val blockedEvents = listOf("Spooky Festival", "5th SkyBlock Anniversary") if (blockedEvents.contains(currentActiveEvent.removeColor())) return emptyList() val currentActiveEventTime = TabListData.getTabList().firstOrNull { SbPattern.eventTimeEndsPattern.matches(it) } @@ -529,3 +534,7 @@ private fun getQueueShowWhen(): Boolean = SbPattern.queuePattern.anyMatches(getS private fun getRedstoneLines(): List<String> = listOf(getSbLines().first { SbPattern.redstonePattern.matches(it) }) private fun getRedstoneShowWhen(): Boolean = SbPattern.redstonePattern.anyMatches(getSbLines()) + +private fun getAnniversaryLines() = listOf(getSbLines().first { SbPattern.anniversaryPattern.matches(it) }) + +private fun getAnniversaryShowWhen(): Boolean = SbPattern.anniversaryPattern.anyMatches(getSbLines()) 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 c04461433..6b70cd683 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 @@ -360,7 +360,15 @@ object ScoreboardPattern { ) val queuePositionPattern by miscSb.pattern( "queueposition", - "Position: (?:§.)*#\\d+ (?:§.)*Since: (?:§.)*.*" + "Position: (?:§.)*#\\d+ (?:§.)*Since: (?:§.)*.*", + ) + + /** + * REGEX-TEST: §d5th Anniversary§f 167:59:54 + */ + val anniversaryPattern by miscSb.pattern( + "anniversary", + "§d\\d+(?:st|nd|rd|th) Anniversary§f (?:\\d|:)+", ) // this thirdObjectiveLinePattern includes all those weird objective lines that go into a third scoreboard line 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 eeaa0b447..75bfa1a80 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 @@ -88,6 +88,7 @@ object UnknownLinesHandler { SbPattern.slayerQuestPattern, SbPattern.essencePattern, SbPattern.redstonePattern, + SbPattern.anniversaryPattern, SbPattern.visitingPattern, SbPattern.flightDurationPattern, SbPattern.dojoChallengePattern, diff --git a/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt index 6b4d70046..87261b6d0 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt @@ -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) = |