diff options
author | J10a1n15 <45315647+j10a1n15@users.noreply.github.com> | 2024-03-28 10:07:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-28 10:07:10 +0100 |
commit | 0beb9e3b3132bcc14c99759628732625ee97d6a8 (patch) | |
tree | 314ec7c1904072821d067f6ce36242615466c13e /src/main/java/at | |
parent | 78ede4944f463fd2f0ac3715d68c3c6530c3f09e (diff) | |
download | skyhanni-0beb9e3b3132bcc14c99759628732625ee97d6a8.tar.gz skyhanni-0beb9e3b3132bcc14c99759628732625ee97d6a8.tar.bz2 skyhanni-0beb9e3b3132bcc14c99759628732625ee97d6a8.zip |
Improvement: Reordered Custom Scoreboard Config (#1294)
Diffstat (limited to 'src/main/java/at')
10 files changed, 159 insertions, 98 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt index ae97457ff..26ce3dfbc 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt @@ -11,7 +11,7 @@ import com.google.gson.JsonPrimitive object ConfigUpdaterMigrator { val logger = LorenzLogger("ConfigMigration") - const val CONFIG_VERSION = 30 + const val CONFIG_VERSION = 31 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/config/features/dev/DevConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/dev/DevConfig.java index 3b5200c39..29d9e1779 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/dev/DevConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/dev/DevConfig.java @@ -49,6 +49,12 @@ public class DevConfig { @ConfigEditorSlider(minValue = 0, maxValue = 50, minStep = 1) public int bowSoundDistance = 5; + @Expose + @ConfigOption(name = "Unknown Lines warning", desc = "Gives a chat warning when unknown lines are found in the scoreboard." + + "\nCustom Scoreboard debug option") + @ConfigEditorBoolean + public boolean unknownLinesWarning = false; + @ConfigOption(name = "Parkour Waypoints", desc = "") @Accordion @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/ArrowConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/ArrowConfig.java new file mode 100644 index 000000000..66dc1fda2 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/ArrowConfig.java @@ -0,0 +1,35 @@ +package at.hannibal2.skyhanni.config.features.gui.customscoreboard; + +import com.google.gson.annotations.Expose; +import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; +import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; +import io.github.moulberry.moulconfig.annotations.ConfigOption; + +public class ArrowConfig { + @Expose + @ConfigOption(name = "Arrow Amount Display", desc = "Determines how the arrow amount is displayed.") + @ConfigEditorDropdown + public ArrowAmountDisplay arrowAmountDisplay = ArrowAmountDisplay.NUMBER; + + public enum ArrowAmountDisplay { + NUMBER("Number"), + PERCENTAGE("Percentage"), + ; + + private final String str; + + ArrowAmountDisplay(String str) { + this.str = str; + } + + @Override + public String toString() { + return str; + } + } + + @Expose + @ConfigOption(name = "Color Arrow Amount", desc = "Color the arrow amount based on the percentage.") + @ConfigEditorBoolean + public boolean colorArrowAmount = false; +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/CustomScoreboardConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/CustomScoreboardConfig.java index 964a198dd..0fe04095d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/CustomScoreboardConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/CustomScoreboardConfig.java @@ -33,33 +33,18 @@ public class CustomScoreboardConfig { @Expose @ConfigOption(name = "Display Options", desc = "") @Accordion - public DisplayConfig displayConfig = new DisplayConfig(); + public DisplayConfig display = new DisplayConfig(); @Expose @ConfigOption(name = "Background Options", desc = "") @Accordion - public BackgroundConfig backgroundConfig = new BackgroundConfig(); - - @Expose - @ConfigOption(name = "Party Options", desc = "") - @Accordion - public PartyConfig partyConfig = new PartyConfig(); - - @Expose - @ConfigOption(name = "Mayor Options", desc = "") - @Accordion - public MayorConfig mayorConfig = new MayorConfig(); + public BackgroundConfig background = new BackgroundConfig(); @Expose @ConfigOption(name = "Information Filtering", desc = "") @Accordion - public InformationFilteringConfig informationFilteringConfig = new InformationFilteringConfig(); - + public InformationFilteringConfig informationFiltering = new InformationFilteringConfig(); - @Expose - @ConfigOption(name = "Unknown Lines warning", desc = "Gives a chat warning when unknown lines are found in the scoreboard.") - @ConfigEditorBoolean - public boolean unknownLinesWarning = true; @Expose public Position position = new Position(10, 80, false, true); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java index a9d176265..b8d5e82c2 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java @@ -16,14 +16,35 @@ public class DisplayConfig { public AlignmentConfig alignment = new AlignmentConfig(); @Expose - @ConfigOption(name = "Title and Footer Options", desc = "") + @ConfigOption(name = "Arrow Options", desc = "") @Accordion - public TitleAndFooterConfig titleAndFooter = new TitleAndFooterConfig(); + public ArrowConfig arrow = new ArrowConfig(); @Expose @ConfigOption(name = "Events Options", desc = "") @Accordion - public EventsConfig eventsConfig = new EventsConfig(); + public EventsConfig events = new EventsConfig(); + + @Expose + @ConfigOption(name = "Maxwell Options", desc = "") + @Accordion + public MaxwellConfig maxwell = new MaxwellConfig(); + + @Expose + @ConfigOption(name = "Mayor Options", desc = "") + @Accordion + public MayorConfig mayor = new MayorConfig(); + + @Expose + @ConfigOption(name = "Party Options", desc = "") + @Accordion + public PartyConfig party = new PartyConfig(); + + @Expose + @ConfigOption(name = "Title and Footer Options", desc = "") + @Accordion + public TitleAndFooterConfig titleAndFooter = new TitleAndFooterConfig(); + @Expose @ConfigOption(name = "Hide Vanilla Scoreboard", desc = "Hide the vanilla scoreboard." + @@ -44,11 +65,6 @@ public class DisplayConfig { public boolean showUnclaimedBits = false; @Expose - @ConfigOption(name = "Show Magical Power", desc = "Show your amount of Magical Power in the scoreboard.") - @ConfigEditorBoolean - public boolean showMagicalPower = true; - - @Expose @ConfigOption(name = "Show Max Island Players", desc = "Show the maximum amount of players that can join your current island.") @ConfigEditorBoolean public boolean showMaxIslandPlayers = true; @@ -75,43 +91,6 @@ public class DisplayConfig { } @Expose - @ConfigOption(name = "Arrow Amount Display", desc = "Determines how the arrow amount is displayed.") - @ConfigEditorDropdown - public ArrowAmountDisplay arrowAmountDisplay = ArrowAmountDisplay.NUMBER; - - public enum ArrowAmountDisplay { - NUMBER("Number"), - PERCENTAGE("Percentage"), - ; - - private final String str; - - ArrowAmountDisplay(String str) { - this.str = str; - } - - @Override - public String toString() { - return str; - } - } - - @Expose - @ConfigOption(name = "Color Arrow Amount", desc = "Color the arrow amount based on the percentage.") - @ConfigEditorBoolean - public boolean colorArrowAmount = false; - - @Expose - @ConfigOption(name = "Compact Tuning", desc = "Show tuning stats compact") - @ConfigEditorBoolean - public boolean compactTuning = false; - - @Expose - @ConfigOption(name = "Tuning Amount", desc = "Only show the first # tunings.\n§cDoes not work with Compact Tuning.") - @ConfigEditorSlider(minValue = 1, maxValue = 8, minStep = 1) - public int tuningAmount = 2; - - @Expose @ConfigOption(name = "Line Spacing", desc = "The amount of space between each line.") @ConfigEditorSlider(minValue = 0, maxValue = 20, minStep = 1) public int lineSpacing = 10; diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/MaxwellConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/MaxwellConfig.java new file mode 100644 index 000000000..910414653 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/MaxwellConfig.java @@ -0,0 +1,24 @@ +package at.hannibal2.skyhanni.config.features.gui.customscoreboard; + +import com.google.gson.annotations.Expose; +import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; +import io.github.moulberry.moulconfig.annotations.ConfigEditorSlider; +import io.github.moulberry.moulconfig.annotations.ConfigOption; + +public class MaxwellConfig { + + @Expose + @ConfigOption(name = "Show Magical Power", desc = "Show your amount of Magical Power in the scoreboard.") + @ConfigEditorBoolean + public boolean showMagicalPower = true; + + @Expose + @ConfigOption(name = "Compact Tuning", desc = "Show tuning stats compact") + @ConfigEditorBoolean + public boolean compactTuning = false; + + @Expose + @ConfigOption(name = "Tuning Amount", desc = "Only show the first # tunings.\n§cDoes not work with Compact Tuning.") + @ConfigEditorSlider(minValue = 1, maxValue = 8, minStep = 1) + public int tuningAmount = 2; +} 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 b9ad9960e..37e2a2098 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 @@ -52,7 +52,7 @@ class CustomScoreboard { RenderBackground().renderBackground() val render = - if (!TabListData.fullyLoaded && config.displayConfig.cacheScoreboardOnIslandSwitch && cache.isNotEmpty()) { + if (!TabListData.fullyLoaded && displayConfig.cacheScoreboardOnIslandSwitch && cache.isNotEmpty()) { cache } else { display @@ -67,7 +67,6 @@ class CustomScoreboard { @SubscribeEvent fun onGuiPositionMoved(event: GuiPositionMovedEvent) { if (event.guiName == guiName) { - val alignmentConfig = config.displayConfig.alignment if (alignmentConfig.alignRight || alignmentConfig.alignCenterVertically) { alignmentConfig.alignRight = false alignmentConfig.alignCenterVertically = false @@ -94,10 +93,16 @@ 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 + internal val displayConfig get() = config.display + internal val alignmentConfig get() = displayConfig.alignment + internal val arrowConfig get() = displayConfig.arrow + internal val eventsConfig get() = displayConfig.events + internal val mayorConfig get() = displayConfig.mayor + internal val partyConfig get() = displayConfig.party + internal val maxwellConfig get() = displayConfig.maxwell + internal val informationFilteringConfig get() = config.informationFiltering + internal val backgroundConfig get() = config.background + internal val devConfig get() = SkyHanniMod.feature.dev } private fun createLines() = buildList<ScoreboardElementType> { @@ -129,7 +134,7 @@ class CustomScoreboard { } private fun List<ScoreboardElementType>.removeEmptyLinesFromEdges(): List<ScoreboardElementType> { - if (config.informationFilteringConfig.hideEmptyLinesAtTopAndBottom) { + if (config.informationFiltering.hideEmptyLinesAtTopAndBottom) { return this .dropWhile { it.first.isEmpty() } .dropLastWhile { it.first.isEmpty() } @@ -164,16 +169,39 @@ class CustomScoreboard { } private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled - private fun isHideVanillaScoreboardEnabled() = isEnabled() && config.displayConfig.hideVanillaScoreboard + private fun isHideVanillaScoreboardEnabled() = isEnabled() && displayConfig.hideVanillaScoreboard @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { - val prefix = "gui.customScoreboard.displayConfig" - event.move(28, "$prefix.showAllActiveEvents", "$prefix.eventsConfig.showAllActiveEvents") - event.transform(30, "$prefix.eventsConfig.eventEntries") { element -> + val prefix = "gui.customScoreboard" + val displayConfigPrefix = "$prefix.displayConfig" + val displayPrefix = "$prefix.display" + event.move(28, "$prefix.displayConfig.showAllActiveEvents", "$prefix.displayConfig.eventsConfig.showAllActiveEvents") + event.transform(30, "$prefix.displayConfig.eventsConfig.eventEntries") { element -> val array = element.asJsonArray array.add(JsonPrimitive(ScoreboardEvents.HOT_DOG_CONTEST.name)) array } + + event.move(31, "$displayConfigPrefix.arrowAmountDisplay", "$displayPrefix.arrow.amountDisplay") + event.move(31, "$displayConfigPrefix.colorArrowAmount", "$displayPrefix.arrow.colorArrowAmount") + event.move(31, "$displayConfigPrefix.showMagicalPower", "$displayPrefix.maxwell.showMagicalPower") + event.move(31, "$displayConfigPrefix.compactTuning", "$displayPrefix.maxwell.compactTuning") + event.move(31, "$displayConfigPrefix.tuningAmount", "$displayPrefix.maxwell.tuningAmount") + event.move(31, "$displayConfigPrefix.hideVanillaScoreboard", "$displayPrefix.hideVanillaScoreboard") + event.move(31, "$displayConfigPrefix.displayNumbersFirst", "$displayPrefix.displayNumbersFirst") + event.move(31, "$displayConfigPrefix.showUnclaimedBits", "$displayPrefix.showUnclaimedBits") + event.move(31, "$displayConfigPrefix.showMaxIslandPlayers", "$displayPrefix.showMaxIslandPlayers") + event.move(31, "$displayConfigPrefix.numberFormat", "$displayPrefix.numberFormat") + event.move(31, "$displayConfigPrefix.lineSpacing", "$displayPrefix.lineSpacing") + event.move(31, "$displayConfigPrefix.cacheScoreboardOnIslandSwitch", "$displayPrefix.cacheScoreboardOnIslandSwitch") + // Categories + event.move(31, "$displayConfigPrefix.alignment", "$displayPrefix.alignment") + event.move(31, "$displayConfigPrefix.titleAndFooter", "$displayPrefix.titleAndFooter") + event.move(31, "$prefix.backgroundConfig", "$prefix.background") + event.move(31, "$prefix.informationFilteringConfig", "$prefix.informationFiltering") + event.move(31, "$displayConfigPrefix.eventsConfig", "$displayPrefix.events") + event.move(31, "$prefix.mayorConfig", "$displayPrefix.mayor") + event.move(31, "$prefix.partyConfig", "$displayPrefix.party") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardUtils.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardUtils.kt index 74ba89dd6..d93e40503 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardUtils.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.config.features.gui.customscoreboard.DisplayConfig import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.features.bingo.BingoAPI -import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.config +import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.displayConfig import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatDouble @@ -15,7 +15,6 @@ import at.hannibal2.skyhanni.utils.TabListData import java.util.regex.Pattern object CustomScoreboardUtils { - private val numberFormat get() = config.displayConfig.numberFormat internal fun getGroupFromPattern(list: List<String>, pattern: Pattern, group: String) = list.map { it.removeResets().trimWhiteSpace() @@ -41,7 +40,7 @@ object CustomScoreboardUtils { return tabList.footer_skyhanni.formattedText.replace("§r", "") } - internal fun Number.formatNum(): String = when (numberFormat) { + internal fun Number.formatNum(): String = when (displayConfig.numberFormat) { DisplayConfig.NumberFormat.SHORT -> NumberUtil.format(this) DisplayConfig.NumberFormat.LONG -> this.addSeparators() else -> "0" diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/RenderBackground.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/RenderBackground.kt index c110e7cf1..5cd86d99e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/RenderBackground.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/RenderBackground.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.data.GuiEditManager import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsX import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsY import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getDummySize +import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.alignmentConfig import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.backgroundConfig import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.config import at.hannibal2.skyhanni.utils.RenderUtils @@ -32,15 +33,15 @@ class RenderBackground { // Update the position to the alignment options if ( - config.displayConfig.alignment.alignRight - || config.displayConfig.alignment.alignCenterVertically + alignmentConfig.alignRight + || alignmentConfig.alignCenterVertically ) { position.set( Position( - if (config.displayConfig.alignment.alignRight) + if (alignmentConfig.alignRight) scaledWidth - elementWidth - (border * 2) else x, - if (config.displayConfig.alignment.alignCenterVertically) + if (alignmentConfig.alignCenterVertically) scaledHeight / 2 - elementHeight / 2 else y, position.getScale(), 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 6502b8f74..2800df6aa 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 @@ -1,6 +1,6 @@ package at.hannibal2.skyhanni.features.gui.customscoreboard -import at.hannibal2.skyhanni.config.features.gui.customscoreboard.DisplayConfig.ArrowAmountDisplay +import at.hannibal2.skyhanni.config.features.gui.customscoreboard.ArrowConfig.ArrowAmountDisplay import at.hannibal2.skyhanni.data.BitsAPI import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.data.HypixelData.Companion.getMaxPlayersForCurrentServer @@ -15,9 +15,13 @@ import at.hannibal2.skyhanni.data.QuiverAPI.NONE_ARROW_TYPE import at.hannibal2.skyhanni.data.QuiverAPI.asArrowPercentage import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.data.SlayerAPI -import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.config +import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.arrowConfig +import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.devConfig import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.displayConfig import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.informationFilteringConfig +import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.maxwellConfig +import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.mayorConfig +import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.partyConfig import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboardUtils.formatNum import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboardUtils.getGroupFromPattern import at.hannibal2.skyhanni.test.command.ErrorManager @@ -28,10 +32,10 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.inDungeons import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.percentageColor import at.hannibal2.skyhanni.utils.RenderUtils.HorizontalAlignment -import at.hannibal2.skyhanni.utils.StringUtils import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.matches +import at.hannibal2.skyhanni.utils.StringUtils.pluralize import at.hannibal2.skyhanni.utils.TabListData import at.hannibal2.skyhanni.utils.TimeUtils.format import at.hannibal2.skyhanni.utils.TimeUtils.formatted @@ -537,7 +541,7 @@ private fun getLobbyDisplayPair(): List<ScoreboardElementType> { private fun getPowerDisplayPair() = listOf( (MaxwellAPI.currentPower?.let { - val mp = if (displayConfig.showMagicalPower) "§7(§6${MaxwellAPI.magicalPower?.addSeparators()}§7)" else "" + val mp = if (maxwellConfig.showMagicalPower) "§7(§6${MaxwellAPI.magicalPower?.addSeparators()}§7)" else "" val name = it.replace(" Power", "") if (displayConfig.displayNumbersFirst) { "§a$name Power $mp" @@ -552,8 +556,8 @@ private fun getTuningDisplayPair(): List<Pair<String, HorizontalAlignment>> { val tunings = MaxwellAPI.tunings ?: return listOf("§cTalk to \"Maxwell\"!" to HorizontalAlignment.LEFT) if (tunings.isEmpty()) return listOf("§cNo Maxwell Tunings :(" to HorizontalAlignment.LEFT) - val title = StringUtils.pluralize(tunings.size, "Tuning", "Tunings") - return if (displayConfig.compactTuning) { + val title = pluralize(tunings.size, "Tuning", "Tunings") + return if (maxwellConfig.compactTuning) { val tuning = tunings .take(3) .joinToString("§7, ") { tuning -> @@ -575,7 +579,7 @@ private fun getTuningDisplayPair(): List<Pair<String, HorizontalAlignment>> { ) } else { val tuning = tunings - .take(displayConfig.tuningAmount.coerceAtLeast(1)) + .take(maxwellConfig.tuningAmount.coerceAtLeast(1)) .map { tuning -> with(tuning) { " §7- §f" + if (displayConfig.displayNumbersFirst) { @@ -663,14 +667,14 @@ private fun getQuiverDisplayPair(): List<ScoreboardElementType> { if (QuiverAPI.currentArrow == NONE_ARROW_TYPE) return listOf("No Arrows selected" to HorizontalAlignment.LEFT) - val amountString = (if (displayConfig.colorArrowAmount) { + val amountString = (if (arrowConfig.colorArrowAmount) { percentageColor( QuiverAPI.currentAmount.toLong(), QuiverAPI.MAX_ARROW_AMOUNT.toLong() ).getChatColor() } else { "" - }) + when (displayConfig.arrowAmountDisplay) { + }) + when (arrowConfig.arrowAmountDisplay) { ArrowAmountDisplay.NUMBER -> QuiverAPI.currentAmount.addSeparators() ArrowAmountDisplay.PERCENTAGE -> "${QuiverAPI.currentAmount.asArrowPercentage()}%" else -> QuiverAPI.currentAmount.addSeparators() @@ -751,13 +755,13 @@ private fun getMayorDisplayPair() = buildList { add( ((MayorAPI.currentMayor?.mayorName?.let { MayorAPI.mayorNameWithColorCode(it) } ?: "<hidden>") + - (if (config.mayorConfig.showTimeTillNextMayor) { + (if (mayorConfig.showTimeTillNextMayor) { "§7 (§e${MayorAPI.timeTillNextMayor.format(maxUnits = 2)}§7)" } else { "" })) to HorizontalAlignment.LEFT ) - if (config.mayorConfig.showMayorPerks) { + if (mayorConfig.showMayorPerks) { MayorAPI.currentMayor?.activePerks?.forEach { add(" §7- §e${it.perkName}" to HorizontalAlignment.LEFT) } @@ -774,7 +778,7 @@ private fun getPartyDisplayPair() = val title = if (PartyAPI.partyMembers.isEmpty()) "§9§lParty" else "§9§lParty (${PartyAPI.partyMembers.size})" val partyList = PartyAPI.partyMembers - .take(config.partyConfig.maxPartyList.get()) + .take(partyConfig.maxPartyList.get()) .map { " §7- §f$it" } @@ -785,7 +789,7 @@ private fun getPartyDisplayPair() = private fun getPartyShowWhen() = if (inDungeons) { false // Hidden bc the scoreboard lines already exist } else { - if (config.partyConfig.showPartyEverywhere) { + if (partyConfig.showPartyEverywhere) { true } else { inAnyIsland( @@ -804,10 +808,10 @@ private fun getFooterDisplayPair() = listOf( private fun getExtraDisplayPair(): List<ScoreboardElementType> { if (unknownLines.isEmpty()) return listOf("<hidden>" to HorizontalAlignment.LEFT) - if (amountOfUnknownLines != unknownLines.size && config.unknownLinesWarning) { + if (amountOfUnknownLines != unknownLines.size && devConfig.unknownLinesWarning) { ErrorManager.logErrorWithData( - CustomScoreboardUtils.UndetectedScoreboardLines("CustomScoreboard detected ${unknownLines.size} unknown line${if (unknownLines.size > 1) "s" else ""}"), - "CustomScoreboard detected ${unknownLines.size} unknown line${if (unknownLines.size > 1) "s" else ""}", + CustomScoreboardUtils.UndetectedScoreboardLines("CustomScoreboard detected ${pluralize(unknownLines.size, "unknown line", withNumber = true)}"), + "CustomScoreboard detected ${pluralize(unknownLines.size, "unknown line", withNumber = true)}", "Unknown Lines" to unknownLines, "Island" to HypixelData.skyBlockIsland, "Area" to HypixelData.skyBlockArea, |