aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2023-04-22 13:36:38 +0200
committerGitHub <noreply@github.com>2023-04-22 21:36:38 +1000
commit4c6da9bb41db05c08de564b47bbe52b93db71eb4 (patch)
tree5f8bf6d02838427a7793b79571287c5be2c4e1e2 /src
parent02b53848959aa4f23e029d389c9fc93b2027eff1 (diff)
downloadNotEnoughUpdates-4c6da9bb41db05c08de564b47bbe52b93db71eb4.tar.gz
NotEnoughUpdates-4c6da9bb41db05c08de564b47bbe52b93db71eb4.tar.bz2
NotEnoughUpdates-4c6da9bb41db05c08de564b47bbe52b93db71eb4.zip
Fix getting location from scoreboard (#678)
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java2
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/SidebarUtil.kt17
2 files changed, 9 insertions, 10 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
index ffde9ca1..8de320d0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
@@ -362,7 +362,7 @@ public class SBInfo {
}
try {
- List<String> lines = SidebarUtil.readSidebarLines();
+ List<String> lines = SidebarUtil.readSidebarLines(true, false);
boolean tempIsInDungeon = false;
for (String line : lines) {
if (line.contains("Cleared:") && line.contains("%")) {
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/SidebarUtil.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/SidebarUtil.kt
index ad371b56..503085f0 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/SidebarUtil.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/SidebarUtil.kt
@@ -24,18 +24,17 @@ import net.minecraft.scoreboard.Score
import net.minecraft.scoreboard.ScorePlayerTeam
object SidebarUtil {
-
@JvmStatic
- fun readSidebarLines() = readRawSidebarLines(true)
+ @JvmOverloads
+ fun readSidebarLines(cleanColor: Boolean = true, cleanSpecialCharacters: Boolean = true): List<String> {
+ var result = readRawSidebarLines()
+ if (cleanColor) result = result.map { Utils.cleanColour(it) }
+ if (cleanSpecialCharacters) result.map { cleanSB(it) }
+ return result
+ }
@JvmStatic
- fun readRawSidebarLines(cleanColor: Boolean = false): List<String> {
- val list = fetchScoreboardLines().reversed()
- val result = list.map { cleanSB(it) }
- return if (cleanColor) {
- result.map { Utils.cleanColour(it) }
- } else result
- }
+ fun readRawSidebarLines() = fetchScoreboardLines().reversed()
private fun cleanSB(scoreboard: String) =
scoreboard.toCharArray().filter { it.code in 21..126 || it.code == 167 }.joinToString(separator = "")