summaryrefslogtreecommitdiff
path: root/platform-paper/src
diff options
context:
space:
mode:
authorSho Sakuma <me@m1sk9.dev>2026-01-31 17:51:47 +0900
committerSho Sakuma <me@m1sk9.dev>2026-01-31 17:51:47 +0900
commit3f7021a3bd407f4133e76dab22cc68e31ffd018c (patch)
tree98fe55e2d0fc6dc0998f973825cb6b205ac7a9c6 /platform-paper/src
parentcdb03c1e628004820b0d2b70682f52f4f97c4663 (diff)
downloadLunaticChat-3f7021a3bd407f4133e76dab22cc68e31ffd018c.tar.gz
LunaticChat-3f7021a3bd407f4133e76dab22cc68e31ffd018c.tar.bz2
LunaticChat-3f7021a3bd407f4133e76dab22cc68e31ffd018c.zip
fix: Prevent other plugins from intercepting channel chat
Diffstat (limited to 'platform-paper/src')
-rw-r--r--platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/listener/PlayerChatListener.kt10
1 files changed, 8 insertions, 2 deletions
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/listener/PlayerChatListener.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/listener/PlayerChatListener.kt
index ec8804d..861707a 100644
--- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/listener/PlayerChatListener.kt
+++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/listener/PlayerChatListener.kt
@@ -13,6 +13,7 @@ import kotlinx.coroutines.runBlocking
import net.kyori.adventure.text.Component
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer
import org.bukkit.event.EventHandler
+import org.bukkit.event.EventPriority
import org.bukkit.event.Listener
class PlayerChatListener(
@@ -25,7 +26,7 @@ class PlayerChatListener(
) : Listener {
private val plainTextSerializer = PlainTextComponentSerializer.plainText()
- @EventHandler(ignoreCancelled = true)
+ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
fun onChat(event: AsyncChatEvent) {
val player = event.player
val settings = settingsManager.getSettings(player.uniqueId)
@@ -81,8 +82,13 @@ class PlayerChatListener(
val hasActiveChannel = channelManager.getPlayerChannel(player.uniqueId) != null
if (hasActiveChannel) {
- // Send to channel as normal
+ // Cancel event and clear all data to prevent other plugins from capturing it
+ // Even MONITOR priority listeners with ignoreCancelled=false won't get useful data
+ // Message will be delivered by ChannelMessageHandler instead
+ // Logging is handled by our own ChannelMessageLogger
event.isCancelled = true
+ event.viewers().clear()
+ event.message(Component.empty())
channelMessageHandler.sendChannelMessage(player, messageWithoutPrefix)
} else {
// Auto-fallback to global chat