diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2023-05-07 04:57:12 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-06 20:57:12 +0200 |
commit | 92352ba052c1c3e403ef41493cbf57f8be63639b (patch) | |
tree | 05e63ff23bc750a73d3f570df652ec5e489ecedb /src/main/java/at/hannibal2/skyhanni/test/command | |
parent | a2415221255e9e5bd0f12a4876117064c3ded3e5 (diff) | |
download | skyhanni-92352ba052c1c3e403ef41493cbf57f8be63639b.tar.gz skyhanni-92352ba052c1c3e403ef41493cbf57f8be63639b.tar.bz2 skyhanni-92352ba052c1c3e403ef41493cbf57f8be63639b.zip |
Added a few commands for debugging and testing (#93)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/test/command')
4 files changed, 72 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt index 92275ed69..10865a213 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt @@ -1,6 +1,6 @@ package at.hannibal2.skyhanni.test.command -import at.hannibal2.skyhanni.test.LorenzTest +import at.hannibal2.skyhanni.test.SkyHanniTestCommand import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils @@ -32,7 +32,7 @@ object CopyItemCommand { resultList.add("") resultList.add("ExtraAttributes") val extraAttributes = tagCompound.getCompoundTag("ExtraAttributes") - LorenzTest.runn(extraAttributes, " . ") + SkyHanniTestCommand.runn(extraAttributes, " . ") } } diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyScoreboardCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyScoreboardCommand.kt new file mode 100644 index 000000000..b53b2af19 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyScoreboardCommand.kt @@ -0,0 +1,25 @@ +package at.hannibal2.skyhanni.test.command + +import at.hannibal2.skyhanni.data.ScoreboardData +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.OSUtils +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") + } + } +}
\ 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 new file mode 100644 index 000000000..65ec85d37 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyTabListCommand.kt @@ -0,0 +1,25 @@ +package at.hannibal2.skyhanni.test.command + +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.OSUtils +import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import at.hannibal2.skyhanni.utils.TabListData + +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 + resultList.add("'$tabListLine'") + } + val string = resultList.joinToString("\n") + OSUtils.copyToClipboard(string) + LorenzUtils.chat("§e[SkyHanni] tablist copied into the clipboard!") + } + catch (_: Throwable) { + LorenzUtils.chat("§c[SkyHanni] Nothing in tablist") + } + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt new file mode 100644 index 000000000..39740a8ec --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt @@ -0,0 +1,20 @@ +package at.hannibal2.skyhanni.test.command + +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.util.ChatComponentText +import net.minecraftforge.client.event.ClientChatReceivedEvent +import net.minecraftforge.common.MinecraftForge + +object TestChatCommand { + fun command(args: Array<String>) { + if (args.isEmpty()) { + LorenzUtils.chat("§c[SkyHanni] Specify a chat message to test") + return + } + val rawMessage = args.toList().joinToString(" ") + LorenzUtils.chat("§a[SkyHanni] testing message: §7$rawMessage") + val formattedMessage = rawMessage.replace("&", "§") + LorenzUtils.chat(formattedMessage) + MinecraftForge.EVENT_BUS.post(ClientChatReceivedEvent(0, ChatComponentText(formattedMessage))) + } +}
\ No newline at end of file |