aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardUtils.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt81
3 files changed, 42 insertions, 48 deletions
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 36774faa5..bb06b0517 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
@@ -11,7 +11,6 @@ import at.hannibal2.skyhanni.utils.NumberUtil.formatDouble
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeResets
import at.hannibal2.skyhanni.utils.StringUtils.trimWhiteSpace
-import at.hannibal2.skyhanni.utils.TabListData
import java.util.regex.Pattern
object CustomScoreboardUtils {
@@ -34,10 +33,6 @@ object CustomScoreboardUtils {
else -> "§e"
}
- fun getTablistFooter(): String {
- return TabListData.getFooter().removeResets()
- }
-
internal fun Number.formatNum(): String = when (displayConfig.numberFormat) {
DisplayConfig.NumberFormat.SHORT -> NumberUtil.format(this)
DisplayConfig.NumberFormat.LONG -> this.addSeparators()
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 6cde610cb..f30ac50ba 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
@@ -15,6 +15,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.StringUtils.anyMatches
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.matches
+import at.hannibal2.skyhanni.utils.StringUtils.removeResets
import at.hannibal2.skyhanni.utils.TabListData
import java.util.function.Supplier
import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern as SbPattern
@@ -399,7 +400,8 @@ private fun getSpookyLines() = buildList {
getSbLines().firstOrNull { SbPattern.spookyPattern.matches(it) }?.let { add(it) } // Time
add("§7Your Candy: ")
add(
- CustomScoreboardUtils.getTablistFooter()
+ TabListData.getFooter()
+ .removeResets()
.split("\n")
.firstOrNull { it.startsWith("§7Your Candy:") }
?.removePrefix("§7Your Candy:") ?: "§cCandy not found"
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt
index 5c037eecb..9d21c7421 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt
@@ -57,7 +57,6 @@ object TabListReader {
val renderColumns = mutableListOf<RenderColumn>()
-
private fun updateTablistData(tablist: List<String>? = null) {
if (!LorenzUtils.inSkyBlock) return
if (!config.enabled.get()) return
@@ -197,60 +196,58 @@ object TabListReader {
var firstColumnCopy = firstColumn
var lastTitle: String? = null
- for (column in columns) {
- for (section in column.sections) {
- var sectionSize = section.size()
+ for (section in columns.flatMap { it.sections }) {
+ var sectionSize = section.size()
+
+ var needsTitle = false
+ if (lastTitle != section.columnValue.columnTitle) {
+ needsTitle = true
+ sectionSize++
+ }
+
+ var currentCount = firstColumnCopy.size()
- var needsTitle = false
- if (lastTitle != section.columnValue.columnTitle) {
- needsTitle = true
- sectionSize++
+ if (sectionSize >= TabListRenderer.MAX_LINES / 2) {
+ if (currentCount >= TabListRenderer.MAX_LINES) {
+ renderColumns.add(RenderColumn().also { firstColumnCopy = it })
+ currentCount = 1
+ } else {
+ if (firstColumnCopy.size() > 0) {
+ firstColumnCopy.addLine(AdvancedPlayerList.createTabLine("", TabStringType.TEXT))
+ }
}
- var currentCount = firstColumnCopy.size()
+ if (needsTitle) {
+ lastTitle = section.columnValue.columnTitle
+ firstColumnCopy.addLine(AdvancedPlayerList.createTabLine(lastTitle, TabStringType.TITLE))
+ currentCount++
+ }
- if (sectionSize >= TabListRenderer.MAX_LINES / 2) {
+ for (line in section.lines) {
if (currentCount >= TabListRenderer.MAX_LINES) {
renderColumns.add(RenderColumn().also { firstColumnCopy = it })
currentCount = 1
- } else {
- if (firstColumnCopy.size() > 0) {
- firstColumnCopy.addLine(AdvancedPlayerList.createTabLine("", TabStringType.TEXT))
- }
- }
-
- if (needsTitle) {
- lastTitle = section.columnValue.columnTitle
- firstColumnCopy.addLine(AdvancedPlayerList.createTabLine(lastTitle, TabStringType.TITLE))
- currentCount++
}
- for (line in section.lines) {
- if (currentCount >= TabListRenderer.MAX_LINES) {
- renderColumns.add(RenderColumn().also { firstColumnCopy = it })
- currentCount = 1
- }
-
- firstColumnCopy.addLine(AdvancedPlayerList.createTabLine(line, TabStringType.fromLine(line)))
- currentCount++
- }
+ firstColumnCopy.addLine(AdvancedPlayerList.createTabLine(line, TabStringType.fromLine(line)))
+ currentCount++
+ }
+ } else {
+ if (currentCount + sectionSize > TabListRenderer.MAX_LINES) {
+ renderColumns.add(RenderColumn().also { firstColumnCopy = it })
} else {
- if (currentCount + sectionSize > TabListRenderer.MAX_LINES) {
- renderColumns.add(RenderColumn().also { firstColumnCopy = it })
- } else {
- if (firstColumnCopy.size() > 0) {
- firstColumnCopy.addLine(AdvancedPlayerList.createTabLine("", TabStringType.TEXT))
- }
+ if (firstColumnCopy.size() > 0) {
+ firstColumnCopy.addLine(AdvancedPlayerList.createTabLine("", TabStringType.TEXT))
}
+ }
- if (needsTitle) {
- lastTitle = section.columnValue.columnTitle
- firstColumnCopy.addLine(AdvancedPlayerList.createTabLine(lastTitle, TabStringType.TITLE))
- }
+ if (needsTitle) {
+ lastTitle = section.columnValue.columnTitle
+ firstColumnCopy.addLine(AdvancedPlayerList.createTabLine(lastTitle, TabStringType.TITLE))
+ }
- for (line in section.lines) {
- firstColumnCopy.addLine(AdvancedPlayerList.createTabLine(line, TabStringType.fromLine(line)))
- }
+ for (line in section.lines) {
+ firstColumnCopy.addLine(AdvancedPlayerList.createTabLine(line, TabStringType.fromLine(line)))
}
}
}