diff options
Diffstat (limited to 'src/main/java/at/hannibal2')
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 |