diff options
| author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-05-08 21:13:21 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-08 21:13:21 +0200 |
| commit | 2d9844426886cd488703d05ee58558e05d4c3987 (patch) | |
| tree | 8315b3b17945ff965af8a3aa8380458f39313fb0 /src/main/java/at/hannibal2/skyhanni/test/command | |
| parent | 64ffd48ac791019ce4e4a610541b143a4c9d9b44 (diff) | |
| download | skyhanni-2d9844426886cd488703d05ee58558e05d4c3987.tar.gz skyhanni-2d9844426886cd488703d05ee58558e05d4c3987.tar.bz2 skyhanni-2d9844426886cd488703d05ee58558e05d4c3987.zip | |
Feature: Profit per corpse loot (#1734)
Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com>
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/test/command')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt index 2007e5b99..6d67a9ad0 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt @@ -21,24 +21,35 @@ object TestChatCommand { val isComplex = mutArgs.remove("-complex") val isClipboard = mutArgs.remove("-clipboard") val isHidden = mutArgs.remove("-s") + val multiLines = mutArgs.remove("-lines") val text = if (isClipboard) { OSUtils.readFromClipboard() ?: return@launchCoroutine ChatUtils.userError("Clipboard does not contain a string!") } else mutArgs.joinToString(" ") - val component = - if (isComplex) - try { - IChatComponent.Serializer.jsonToComponent(text) - } catch (ex: Exception) { - ChatUtils.userError("Please provide a valid JSON chat component (either in the command or via -clipboard)") - return@launchCoroutine - } - else ChatComponentText(text.replace("&", "§")) - if (!isHidden) ChatUtils.chat("Testing message: §7${component.formattedText}", prefixColor = "§a") - test(component) + if (multiLines) { + for (line in text.split("\n")) { + extracted(isComplex, line, isHidden) + } + } else { + extracted(isComplex, text, isHidden) + } } } + private fun extracted(isComplex: Boolean, text: String, isHidden: Boolean) { + val component = + if (isComplex) + try { + IChatComponent.Serializer.jsonToComponent(text) + } catch (ex: Exception) { + ChatUtils.userError("Please provide a valid JSON chat component (either in the command or via -clipboard)") + return + } + else ChatComponentText(text.replace("&", "§")) + if (!isHidden) ChatUtils.chat("Testing message: §7${component.formattedText}", prefixColor = "§a") + test(component) + } + private fun test(componentText: IChatComponent) { val message = componentText.formattedText.stripHypixelMessage() val event = LorenzChatEvent(message, componentText) |
