From f2e677371e85ea857381a02e2e56dd975fbe63f9 Mon Sep 17 00:00:00 2001 From: Boy Date: Fri, 12 Jan 2024 16:16:26 +0100 Subject: [PATCH] fix: DiscordListener not respecting channel.discordsrv setting --- .../mineinabyss/chatty/listeners/DiscordListener.kt | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/chatty-paper/src/main/kotlin/com/mineinabyss/chatty/listeners/DiscordListener.kt b/chatty-paper/src/main/kotlin/com/mineinabyss/chatty/listeners/DiscordListener.kt index 0df4980..9ac5a03 100644 --- a/chatty-paper/src/main/kotlin/com/mineinabyss/chatty/listeners/DiscordListener.kt +++ b/chatty-paper/src/main/kotlin/com/mineinabyss/chatty/listeners/DiscordListener.kt @@ -34,19 +34,10 @@ class DiscordListener { @Subscribe(priority = ListenerPriority.NORMAL) fun GameChatMessagePreProcessEvent.onChat() { - val data = player.toGeary().get() ?: return - val channel = data.channel ?: return - val lastUsedChannel = data.lastChannelUsed ?: return + val channel = player.toGeary().get()?.channel ?: return + if (!channel.discordsrv) isCancelled = true } - // Parse the DSRV Component through the Chatty normal MM instance to format tags, then serialize/deserialize it back to DSRV Component - private fun ComponentDSV.stripFormat(player: Player, channel: ChattyChannel): ComponentDSV = - mm.deserialize(plainText.serialize(this).replace( - plainText.serialize( - mm.deserialize(translatePlaceholders(player, channel.format).parseTags(player, true).serialize()) - ), "" - )) - @Subscribe fun DeathMessagePreProcessEvent.onDeath() { if (isCancelled) return