aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-05-03 14:52:59 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-05-03 14:52:59 +0200
commit5b2a2d067e68d500bd1c19088dae9e624eeae51f (patch)
tree22498ef05fcc1418622e7360f2a5871e2e2aab33 /src/main/java/at/hannibal2/skyhanni
parent0d189dca73408e9fc1976cdbecf8e6bff679ff86 (diff)
downloadskyhanni-5b2a2d067e68d500bd1c19088dae9e624eeae51f.tar.gz
skyhanni-5b2a2d067e68d500bd1c19088dae9e624eeae51f.tar.bz2
skyhanni-5b2a2d067e68d500bd1c19088dae9e624eeae51f.zip
fix color in /translate
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/Translator.kt18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/Translator.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/Translator.kt
index 8e61f4b6c..e513871fe 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/Translator.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/Translator.kt
@@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.ConditionalUtils.transformIf
import at.hannibal2.skyhanni.utils.OSUtils
import at.hannibal2.skyhanni.utils.StringUtils.getPlayerNameFromChatMessage
+import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import com.google.gson.JsonArray
import kotlinx.coroutines.launch
import net.minecraft.event.ClickEvent
@@ -42,18 +43,9 @@ class Translator {
}
private fun createClickStyle(message: String, style: ChatStyle): ChatStyle {
- style.setChatClickEvent(
- ClickEvent(
- ClickEvent.Action.RUN_COMMAND,
- "/shtranslate ${messageContentRegex.find(message)!!.groupValues[1]}"
- )
- )
- style.setChatHoverEvent(
- HoverEvent(
- HoverEvent.Action.SHOW_TEXT,
- ChatComponentText("§bClick to translate!")
- )
- )
+ val text = messageContentRegex.find(message)!!.groupValues[1].removeColor()
+ style.setChatClickEvent(ClickEvent(ClickEvent.Action.RUN_COMMAND, "/shtranslate $text"))
+ style.setChatHoverEvent(HoverEvent(HoverEvent.Action.SHOW_TEXT, ChatComponentText("§bClick to translate!")))
return style
}
@@ -135,7 +127,7 @@ class Translator {
}
fun toEnglish(args: Array<String>) {
- val message = args.joinToString(" ")
+ val message = args.joinToString(" ").removeColor()
coroutineScope.launch {
val translation = getTranslationToEnglish(message)