diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-23 12:43:25 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-23 12:43:25 +0200 |
commit | e4f5cf5565b7742555b1bd4c72616d5ee99af826 (patch) | |
tree | 43abb9c1a681250f2f0a59e3e36e5be52e508545 /src/main/java/at/hannibal2/skyhanni/test/command | |
parent | 368523b99992687fbef3acb29f915c0b6ada5fd9 (diff) | |
download | skyhanni-e4f5cf5565b7742555b1bd4c72616d5ee99af826.tar.gz skyhanni-e4f5cf5565b7742555b1bd4c72616d5ee99af826.tar.bz2 skyhanni-e4f5cf5565b7742555b1bd4c72616d5ee99af826.zip |
code cleanup
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/test/command')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/test/command/CopyScoreboardCommand.kt | 7 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/test/command/CopyTabListCommand.kt | 8 |
2 files changed, 9 insertions, 6 deletions
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 0483001f8..212350fdb 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyScoreboardCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyScoreboardCommand.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.test.command import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.transformIf import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -9,12 +10,12 @@ object CopyScoreboardCommand { fun command(args: Array<String>) { 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("Title:") + resultList.add(ScoreboardData.objectiveTitle.transformIf(noColor) { removeColor() }) resultList.add("") for (line in ScoreboardData.sidebarLinesFormatted) { - val scoreboardLine = if (noColor) line.removeColor() else line + val scoreboardLine = line.transformIf(noColor) { removeColor() } resultList.add("'$scoreboardLine'") } 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 d308ba09e..9a745cc11 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyTabListCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyTabListCommand.kt @@ -2,6 +2,8 @@ package at.hannibal2.skyhanni.test.command import at.hannibal2.skyhanni.mixins.transformers.AccessorGuiPlayerTabOverlay import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.conditionalTransform +import at.hannibal2.skyhanni.utils.LorenzUtils.transformIf import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TabListData @@ -12,12 +14,12 @@ object CopyTabListCommand { 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 + val tabListLine = line.transformIf(noColor) { removeColor() } 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 tabHeader = tabList.header_skyhanni.conditionalTransform(noColor, { unformattedText }, { formattedText }) + val tabFooter = tabList.footer_skyhanni.conditionalTransform(noColor, { unformattedText }, { 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!") |