From 9e474fb8fe76b02960b3743e31015018e8666b7f Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Thu, 10 Aug 2023 17:44:07 +0200 Subject: Better Clipboard (#378) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt | 9 ++++++--- src/main/java/at/hannibal2/skyhanni/test/SkyHanniTestCommand.kt | 6 ++++++ 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/test') diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt index 5d36cdb90..fbdb21257 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt @@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.OSUtils import com.google.gson.JsonElement import io.github.moulberry.notenoughupdates.util.Shimmy +import kotlinx.coroutines.launch import java.lang.reflect.Field import java.lang.reflect.Modifier @@ -20,11 +21,13 @@ object SkyHanniConfigSearchResetCommand { private var lastCommand = emptyArray() fun command(args: Array) { - LorenzUtils.chat(runCommand(args)) + SkyHanniMod.coroutineScope.launch { + LorenzUtils.chat(runCommand(args)) + } lastCommand = args } - private fun runCommand(args: Array): String { + private suspend fun runCommand(args: Array): String { if (args.isEmpty()) { return "§c[SkyHanni] This is a powerful config-edit command, only use it if you know what you are doing!" } @@ -71,7 +74,7 @@ object SkyHanniConfigSearchResetCommand { } } - private fun setCommand(args: Array): String { + private suspend fun setCommand(args: Array): String { if (args.size < 3) return "§c/shconfig set " val term = args[1] var rawJson = args.drop(2).joinToString(" ") diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniTestCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniTestCommand.kt index a3ddcafd0..2cfb5ae94 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniTestCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniTestCommand.kt @@ -45,6 +45,12 @@ class SkyHanniTestCommand { fun testCommand(args: Array) { SoundUtils.playBeepSound() + val a = Thread { OSUtils.copyToClipboard("123") } + val b = Thread { OSUtils.copyToClipboard("456") } + a.start() + b.start() + + // for ((i, s) in ScoreboardData.siedebarLinesFormatted().withIndex()) { // println("$i: '$s'") // } -- cgit