aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2023-09-23 20:42:52 +1000
committerGitHub <noreply@github.com>2023-09-23 12:42:52 +0200
commit368523b99992687fbef3acb29f915c0b6ada5fd9 (patch)
treee09e215f9f3b36991a6b43be2f7216ec03680e95 /src/main
parentec534660a5bdd623b9e61894b2805c82fd701218 (diff)
downloadskyhanni-368523b99992687fbef3acb29f915c0b6ada5fd9.tar.gz
skyhanni-368523b99992687fbef3acb29f915c0b6ada5fd9.tar.bz2
skyhanni-368523b99992687fbef3acb29f915c0b6ada5fd9.zip
guh (#495)
internal sidebar changes #495
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyScoreboardCommand.kt26
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyTabListCommand.kt28
3 files changed, 27 insertions, 30 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
index 9aee68957..c476482cb 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
@@ -27,6 +27,7 @@ class ScoreboardData {
"\uD83C\uDF81",
"\uD83C\uDF89",
"\uD83C\uDF82",
+ "\uD83D\uDD2B",
)
fun formatLines(rawList: List<String>): List<String> {
@@ -49,6 +50,7 @@ class ScoreboardData {
var sidebarLines: List<String> = emptyList() // TODO rename to raw
var sidebarLinesRaw: List<String> = emptyList() // TODO delete
+ var objectiveLine = ""
}
@SubscribeEvent(priority = EventPriority.HIGHEST)
@@ -76,6 +78,7 @@ class ScoreboardData {
private fun fetchScoreboardLines(): List<String> {
val scoreboard = Minecraft.getMinecraft().theWorld?.scoreboard ?: return emptyList()
val objective = scoreboard.getObjectiveInDisplaySlot(1) ?: return emptyList()
+ objectiveLine = objective.displayName
var scores = scoreboard.getSortedScores(objective)
val list = scores.filter { input: Score? ->
input != null && input.playerName != null && !input.playerName.startsWith("#")
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyScoreboardCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyScoreboardCommand.kt
index b53b2af19..0483001f8 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyScoreboardCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyScoreboardCommand.kt
@@ -7,19 +7,19 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor
object CopyScoreboardCommand {
fun command(args: Array<String>) {
- try {
- val resultList = mutableListOf<String>()
- val noColor = args.size == 1 && args[0] == "true"
- for (line in ScoreboardData.sidebarLinesFormatted) {
- val scoreboardLine = if (noColor) line.removeColor() else line
- resultList.add("'$scoreboardLine'")
- }
- val string = resultList.joinToString("\n")
- OSUtils.copyToClipboard(string)
- LorenzUtils.chat("§e[SkyHanni] scoreboard copied into the clipboard!")
- }
- catch (_: Throwable) {
- LorenzUtils.chat("§c[SkyHanni] Nothing in scoreboard")
+ val resultList = mutableListOf<String>()
+ val noColor = args.size == 1 && args[0] == "true"
+ resultList.add("Header:")
+ resultList.add(if (noColor) ScoreboardData.objectiveLine.removeColor() else ScoreboardData.objectiveLine)
+ resultList.add("")
+
+ for (line in ScoreboardData.sidebarLinesFormatted) {
+ val scoreboardLine = if (noColor) line.removeColor() else line
+ resultList.add("'$scoreboardLine'")
}
+
+ val string = resultList.joinToString("\n")
+ OSUtils.copyToClipboard(string)
+ LorenzUtils.chat("§e[BedWar] scoreboard copied into your clipboard!")
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyTabListCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyTabListCommand.kt
index c5c94b8a2..d308ba09e 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyTabListCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyTabListCommand.kt
@@ -9,23 +9,17 @@ import net.minecraft.client.Minecraft
object CopyTabListCommand {
fun command(args: Array<String>) {
- try {
- val resultList = mutableListOf<String>()
- val noColor = args.size == 1 && args[0] == "true"
- for (line in TabListData.getTabList()) {
- val tabListLine = if (noColor) line.removeColor() else line
- if (tabListLine != "") resultList.add("'$tabListLine'")
- }
- val tabList = Minecraft.getMinecraft().ingameGUI.tabList as AccessorGuiPlayerTabOverlay
- val tabHeader = tabList.header_skyhanni.formattedText
- val tabFooter = tabList.footer_skyhanni.formattedText
- val string = "Header:\n\n$tabHeader\n\nBody:\n\n${resultList.joinToString("\n")}\nFooter:\n\n$tabFooter"
- OSUtils.copyToClipboard(string)
- LorenzUtils.chat("§e[SkyHanni] Tab list copied into the clipboard!")
- }
- catch (_: Throwable) {
- // TODO: Note: why are we ignoring this exception? This user facing error message seems out of place to me
- LorenzUtils.chat("§c[SkyHanni] Nothing in tab list")
+ val resultList = mutableListOf<String>()
+ val noColor = args.size == 1 && args[0] == "true"
+ for (line in TabListData.getTabList()) {
+ val tabListLine = if (noColor) line.removeColor() else line
+ if (tabListLine != "") resultList.add("'$tabListLine'")
}
+ val tabList = Minecraft.getMinecraft().ingameGUI.tabList as AccessorGuiPlayerTabOverlay
+ val tabHeader = if (noColor) tabList.header_skyhanni.unformattedText else tabList.header_skyhanni.formattedText
+ val tabFooter = if (noColor) tabList.footer_skyhanni.unformattedText else tabList.footer_skyhanni.formattedText
+ val string = "Header:\n\n$tabHeader\n\nBody:\n\n${resultList.joinToString("\n")}\n\nFooter:\n\n$tabFooter"
+ OSUtils.copyToClipboard(string)
+ LorenzUtils.chat("§e[SkyHanni] Tab list copied into the clipboard!")
}
} \ No newline at end of file