Skip to content

Commit

Permalink
feat: 🎸 γƒγƒ£γƒƒγƒˆε†…γ§γ‚«γƒ©γƒΌγ‚³γƒΌγƒ‰γ‚’δ½Ώη”¨γ§γγ‚‹γ‚ˆγ†γ«
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueSheep2804 committed Jul 11, 2023
1 parent 6717368 commit b14fd9f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import kotlinx.serialization.Serializable
@Serializable
data class SeleneChatConfigData(
@YamlComment("Version of the config file. Do not change.")
val configVersion: Int = 1,
val configVersion: Int = 2,

@YamlComment("Specifying the chat conversion mode.", "Possible values: none, hiragana, ime")
var convertMode: ConvertMode = ConvertMode.IME,
Expand All @@ -16,6 +16,8 @@ data class SeleneChatConfigData(
var useSeleneChatFormat: Boolean = false,
@YamlComment("Whether to receive plugin messages from the server to the proxy server.", "Applies to Bungeecord and Velocity only.")
var shouldReceivePluginMessage: Boolean = false,
@YamlComment("Whether to use color codes (e.g. &4, &b) in the chat.")
var useColorCode: Boolean = true,

@YamlComment(
"Specifies the format of the chat.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import net.kyori.adventure.text.minimessage.tag.Tag
import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer
import java.text.SimpleDateFormat
import java.util.*

Expand All @@ -24,10 +26,15 @@ object ChatMessage {
get() = SimpleDateFormat(config.timeFormat)
fun message(msg: String): Component {
val mm = MiniMessage.miniMessage()
val japaneseConversion = Japanizer(msg)
val serializedMessage = if (config.useColorCode) {
LegacyComponentSerializer.legacyAmpersand().deserialize(msg)
} else {
Component.text(msg)
}
val japaneseConversion = Japanizer(PlainTextComponentSerializer.plainText().serialize(serializedMessage))
val messageTagResolver = Placeholder.component(
"message",
Component.text(msg)
serializedMessage
)
val jpTagResolver = TagResolver.resolver("jp")
{ args: ArgumentQueue, _: Context ->
Expand Down

0 comments on commit b14fd9f

Please sign in to comment.