aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/gui
diff options
context:
space:
mode:
authorJ10a1n15 <45315647+j10a1n15@users.noreply.github.com>2024-03-24 10:56:56 +0100
committerGitHub <noreply@github.com>2024-03-24 10:56:56 +0100
commitff8e74ae6145218b65c63cd445b1035444550e99 (patch)
tree2f6e1bd39209ad7b19ebd3aab0bbe298c60875f6 /src/main/java/at/hannibal2/skyhanni/features/gui
parent0ca2a57b64812e26de24e7de220e4d0e1861bddf (diff)
downloadskyhanni-ff8e74ae6145218b65c63cd445b1035444550e99.tar.gz
skyhanni-ff8e74ae6145218b65c63cd445b1035444550e99.tar.bz2
skyhanni-ff8e74ae6145218b65c63cd445b1035444550e99.zip
Improvement: Events Priority in Custom Scoreboard (#1221)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/gui')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt40
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt147
3 files changed, 149 insertions, 45 deletions
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 87546fb06..3c375a522 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
@@ -18,6 +18,7 @@
package at.hannibal2.skyhanni.features.gui.customscoreboard
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.DebugDataCollectEvent
import at.hannibal2.skyhanni.events.GuiPositionMovedEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
@@ -91,6 +92,7 @@ class CustomScoreboard {
companion object {
internal val config get() = SkyHanniMod.feature.gui.customScoreboard
internal val displayConfig get() = config.displayConfig
+ internal val eventsConfig get() = displayConfig.eventsConfig
internal val informationFilteringConfig get() = config.informationFilteringConfig
internal val backgroundConfig get() = config.backgroundConfig
}
@@ -160,4 +162,9 @@ class CustomScoreboard {
private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled
private fun isHideVanillaScoreboardEnabled() = isEnabled() && config.displayConfig.hideVanillaScoreboard
+
+ @SubscribeEvent
+ fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
+ event.move(28, "gui.customscoreboard.displayConfig.showAllActiveEvents", "gui.customscoreboard.displayConfig.eventsConfig.showAllActiveEvents")
+ }
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt
index 31accaddb..0dfdf7642 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt
@@ -243,6 +243,45 @@ enum class ScoreboardElement(
if (!informationFilteringConfig.hideIrrelevantLines) return true
return showWhen()
}
+
+ companion object {
+ // I don't know why, but this field is needed for it to work
+ @kotlin.jvm.JvmField
+ val defaultOption = listOf(
+ TITLE,
+ PROFILE,
+ PURSE,
+ BANK,
+ MOTES,
+ BITS,
+ COPPER,
+ NORTH_STARS,
+ HEAT,
+ COLD,
+ EMPTY_LINE,
+ ISLAND,
+ LOCATION,
+ LOBBY_CODE,
+ PLAYER_AMOUNT,
+ VISITING,
+ EMPTY_LINE2,
+ DATE,
+ TIME,
+ EVENTS,
+ OBJECTIVE,
+ COOKIE,
+ EMPTY_LINE3,
+ QUIVER,
+ POWER,
+ TUNING,
+ EMPTY_LINE4,
+ POWDER,
+ MAYOR,
+ PARTY,
+ FOOTER,
+ EXTRA
+ )
+ }
}
private fun getTitleDisplayPair() = if (displayConfig.titleAndFooter.useHypixelTitleAnimation) {
@@ -652,6 +691,7 @@ private fun getPowderShowWhen() = inAdvancedMiningIsland()
private fun getEventsDisplayPair(): List<ScoreboardElementType> {
return ScoreboardEvents.getEvent()
+ .filterNotNull()
.flatMap { it.getLines().map { i -> i to HorizontalAlignment.LEFT } }
.takeIf { it.isNotEmpty() } ?: listOf("<hidden>" to HorizontalAlignment.LEFT)
}
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 21ec0d036..c7dd0cfb9 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
@@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.gui.customscoreboard
import at.hannibal2.skyhanni.data.HypixelData
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.data.ScoreboardData
-import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.config
+import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.eventsConfig
import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardEvents.VOTING
import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern
import at.hannibal2.skyhanni.features.misc.ServerRestartTitle
@@ -31,116 +31,181 @@ private fun getSbLines(): List<String> {
return ScoreboardData.sidebarLinesFormatted
}
-enum class ScoreboardEvents(private val displayLine: Supplier<List<String>>, private val showWhen: () -> Boolean) {
+enum class ScoreboardEvents(
+ private val displayLine: Supplier<List<String>>,
+ private val showWhen: () -> Boolean,
+ private val configLine: String
+) {
VOTING(
::getVotingLines,
- ::getVotingShowWhen
+ ::getVotingShowWhen,
+ "§7(All Voting Lines)"
),
SERVER_CLOSE(
::getServerCloseLines,
- ::getServerCloseShowWhen
+ ::getServerCloseShowWhen,
+ "§cServer closing soon!"
),
DUNGEONS(
::getDungeonsLines,
- ::getDungeonsShowWhen
+ ::getDungeonsShowWhen,
+ "§7(All Dungeons Lines)"
),
KUUDRA(
::getKuudraLines,
- ::getKuudraShowWhen
+ ::getKuudraShowWhen,
+ "§7(All Kuudra Lines)"
),
DOJO(
::getDojoLines,
- ::getDojoShowWhen
+ ::getDojoShowWhen,
+ "§7(All Dojo Lines)"
),
DARK_AUCTION(
::getDarkAuctionLines,
- ::getDarkAuctionShowWhen
+ ::getDarkAuctionShowWhen,
+ "Time Left: §b11\n" +
+ "Current Item:\n" +
+ " §5Travel Scroll to Sirius"
),
JACOB_CONTEST(
::getJacobContestLines,
- ::getJacobContestShowWhen
+ ::getJacobContestShowWhen,
+ "§eJacob's Contest\n" +
+ "§e○ §fCarrot §a18m17s\n" +
+ " Collected §e8,264"
),
JACOB_MEDALS(
::getJacobMedalsLines,
- ::getJacobMedalsShowWhen
+ ::getJacobMedalsShowWhen,
+ "§6§lGOLD §fmedals: §613\n" +
+ "§f§lSILVER §fmedals: §f3\n" +
+ "§c§lBRONZE §fmedals: §c4"
),
TRAPPER(
::getTrapperLines,
- ::getTrapperShowWhen
+ ::getTrapperShowWhen,
+ "Pelts: §5711\n" +
+ "Tracker Mob Location:\n" +
+ "§bMushroom Gorge"
),
GARDEN_CLEAN_UP(
::getGardenCleanUpLines,
- ::getGardenCleanUpShowWhen
+ ::getGardenCleanUpShowWhen,
+ "Cleanup: §c12.6%"
),
GARDEN_PASTING(
::getGardenPastingLines,
- ::getGardenPastingShowWhen
+ ::getGardenPastingShowWhen,
+ "§fBarn Pasting§7: §e12.3%"
),
FLIGHT_DURATION(
::getFlightDurationLines,
- ::getFlightDurationShowWhen
+ ::getFlightDurationShowWhen,
+ "Flight Duration: §a10m 0s"
),
WINTER(
::getWinterLines,
- ::getWinterShowWhen
+ ::getWinterShowWhen,
+ "§7(All Winter Event Lines)"
),
SPOOKY(
::getSpookyLines,
- ::getSpookyShowWhen
+ ::getSpookyShowWhen,
+ "§7(All Spooky Event Lines)"
),
BROODMOTHER(
::getBroodmotherLines,
- ::getBroodmotherShowWhen
- ),
- ORINGO(
- ::getOringoLines,
- ::getOringoShowWhen
+ ::getBroodmotherShowWhen,
+ "§4Broodmother§7: §eDormant"
),
MINING_EVENTS(
::getMiningEventsLines,
- ::getMiningEventsShowWhen
+ ::getMiningEventsShowWhen,
+ "§7(All Mining Event Lines)"
),
DAMAGE(
::getDamageLines,
- ::getDamageShowWhen
+ ::getDamageShowWhen,
+ "Dragon HP: §a6,180,925 §c❤\n" +
+ "Your Damage: §c375,298.5"
),
MAGMA_BOSS(
::getMagmaBossLines,
- ::getMagmaBossShowWhen
+ ::getMagmaBossShowWhen,
+ "§7(All Magma Boss Lines)\n" +
+ "§7Boss: §c0%\n" +
+ "§7Damage Soaked:\n" +
+ "§e▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎§7▎▎▎▎▎"
),
ESSENCE(
::getEssenceLines,
- ::getEssenceShowWhen
+ ::getEssenceShowWhen,
+ "Dragon Essence: §d1,285"
),
EFFIGIES(
::getEffigiesLines,
- ::getEffigiesShowWhen
+ ::getEffigiesShowWhen,
+ "Effigies: §c⧯§c⧯⧯§7⧯§c⧯§c⧯"
),
ACTIVE_TABLIST_EVENTS(
::getActiveEventLine,
- ::getActiveEventShowWhen
+ ::getActiveEventShowWhen,
+ "§7(All Active Tablist Events)"
),
REDSTONE(
::getRedstoneLines,
- ::getRedstoneShowWhen
+ ::getRedstoneShowWhen,
+ "§e§l⚡ §cRedstone: §e§b7%"
),
+ ;
- NONE(
- ::getNoneLines,
- { false }
- );
+ override fun toString(): String {
+ return configLine
+ }
fun getLines(): List<String> {
return displayLine.get()
}
companion object {
- fun getEvent(): List<ScoreboardEvents> {
- if (config.displayConfig.showAllActiveEvents) {
- return entries.filter { it.showWhen() }
+ fun getEvent() = buildList<ScoreboardEvents?> {
+ if (eventsConfig.showAllActiveEvents) {
+ for (event in eventsConfig.eventEntries) {
+ if (event.showWhen()) {
+ add(event)
+ }
+ }
+ } else {
+ add(eventsConfig.eventEntries.firstOrNull { it.showWhen() })
}
- return listOf(entries.firstOrNull { it.showWhen() } ?: NONE)
}
+
+ // I don't know why, but this field is needed for it to work
+ @kotlin.jvm.JvmField
+ val defaultOption = listOf(
+ VOTING,
+ SERVER_CLOSE,
+ DUNGEONS,
+ KUUDRA,
+ DOJO,
+ DARK_AUCTION,
+ JACOB_CONTEST,
+ JACOB_MEDALS,
+ TRAPPER,
+ GARDEN_CLEAN_UP,
+ GARDEN_PASTING,
+ FLIGHT_DURATION,
+ WINTER,
+ SPOOKY,
+ BROODMOTHER,
+ MINING_EVENTS,
+ DAMAGE,
+ MAGMA_BOSS,
+ ESSENCE,
+ EFFIGIES,
+ ACTIVE_TABLIST_EVENTS
+ )
}
}
@@ -228,8 +293,7 @@ private fun getDarkAuctionLines() = buildList {
getSbLines().firstOrNull { SbPattern.startingInPattern.matches(it) }?.let { add(it) }
getSbLines().firstOrNull { SbPattern.timeLeftPattern.matches(it) }?.let { add(it) }
- val darkAuctionCurrentItemLine =
- getSbLines().firstOrNull { SbPattern.darkAuctionCurrentItemPattern.matches(it) }
+ val darkAuctionCurrentItemLine = getSbLines().firstOrNull { SbPattern.darkAuctionCurrentItemPattern.matches(it) }
if (darkAuctionCurrentItemLine != null) {
add(darkAuctionCurrentItemLine)
@@ -475,10 +539,3 @@ private fun getRedstoneLines(): List<String> {
private fun getRedstoneShowWhen(): Boolean {
return SbPattern.redstonePattern.anyMatches(getSbLines())
}
-
-private fun getNoneLines(): List<String> {
- return when {
- config.informationFilteringConfig.hideEmptyLines -> listOf("<hidden>")
- else -> listOf("§cNo Event")
- }
-}