aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ10a1n15 <45315647+j10a1n15@users.noreply.github.com>2024-04-15 20:11:21 +0200
committerGitHub <noreply@github.com>2024-04-15 20:11:21 +0200
commitaaaf1b0f8765e76eac852051f3c939897fa5ce48 (patch)
tree84bd511cd390699efe15693488070bed014a2dea
parent8a97c06df5a9f59937709ffbbb717c242be5e8ec (diff)
downloadskyhanni-aaaf1b0f8765e76eac852051f3c939897fa5ce48.tar.gz
skyhanni-aaaf1b0f8765e76eac852051f3c939897fa5ce48.tar.bz2
skyhanni-aaaf1b0f8765e76eac852051f3c939897fa5ce48.zip
Improvement: Added Linebreaks functionality for Custom Scoreboard Title/Footer (#1373)
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/TitleAndFooterConfig.java8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt29
2 files changed, 23 insertions, 14 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/TitleAndFooterConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/TitleAndFooterConfig.java
index 4288e1a58..79c127c57 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/TitleAndFooterConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/TitleAndFooterConfig.java
@@ -15,7 +15,9 @@ public class TitleAndFooterConfig {
public RenderUtils.HorizontalAlignment alignTitleAndFooter = RenderUtils.HorizontalAlignment.CENTER;
@Expose
- @ConfigOption(name = "Custom Title", desc = "What should be displayed as the title of the scoreboard.\nUse & for colors.")
+ @ConfigOption(name = "Custom Title", desc = "What should be displayed as the title of the scoreboard." +
+ "\nUse & for colors." +
+ "\nUse \"\\n\" for new line.")
@ConfigEditorText
public Property<String> customTitle = Property.of("&6&lSKYBLOCK");
@@ -26,7 +28,9 @@ public class TitleAndFooterConfig {
public boolean useHypixelTitleAnimation = false;
@Expose
- @ConfigOption(name = "Custom Footer", desc = "What should be displayed as the footer of the scoreboard.\nUse & for colors.")
+ @ConfigOption(name = "Custom Footer", desc = "What should be displayed as the footer of the scoreboard." +
+ "\nUse & for colors." +
+ "\nUse \"\\n\" for new line.")
@ConfigEditorText
public Property<String> customFooter = Property.of("&ewww.hypixel.net");
}
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 d958c0c9c..e9b4df0a9 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
@@ -309,14 +309,16 @@ enum class ScoreboardElement(
}
}
-private fun getTitleDisplayPair() = if (displayConfig.titleAndFooter.useHypixelTitleAnimation) {
- listOf(ScoreboardData.objectiveTitle to displayConfig.titleAndFooter.alignTitleAndFooter)
-} else {
- listOf(
- displayConfig.titleAndFooter.customTitle.get().toString()
- .replace("&", "§") to displayConfig.titleAndFooter.alignTitleAndFooter
- )
-}
+private fun getTitleDisplayPair(): List<ScoreboardElementType> =
+ if (displayConfig.titleAndFooter.useHypixelTitleAnimation) {
+ listOf(ScoreboardData.objectiveTitle to displayConfig.titleAndFooter.alignTitleAndFooter)
+ } else {
+ listOf(displayConfig.titleAndFooter.customTitle.get().toString()
+ .replace("&", "§")
+ .split("\\n")
+ .map { it to displayConfig.titleAndFooter.alignTitleAndFooter }
+ ).flatten()
+ }
private fun getProfileDisplayPair() =
listOf(CustomScoreboardUtils.getProfileTypeSymbol() + HypixelData.profileName.firstLetterUppercase() to HorizontalAlignment.LEFT)
@@ -764,10 +766,13 @@ private fun getPartyShowWhen() = if (DungeonAPI.inDungeon()) {
}
}
-private fun getFooterDisplayPair() = listOf(
- displayConfig.titleAndFooter.customFooter.get().toString()
- .replace("&", "§") to displayConfig.titleAndFooter.alignTitleAndFooter
-)
+private fun getFooterDisplayPair(): List<ScoreboardElementType> =
+ listOf(displayConfig.titleAndFooter.customFooter.get().toString()
+ .replace("&", "§")
+ .split("\\n")
+ .map { it to displayConfig.titleAndFooter.alignTitleAndFooter }
+ ).flatten()
+
private fun getExtraDisplayPair(): List<ScoreboardElementType> {
if (unknownLines.isEmpty()) return listOf("<hidden>" to HorizontalAlignment.LEFT)