summaryrefslogtreecommitdiff
path: root/platform-paper
diff options
context:
space:
mode:
authorSho Sakuma <me@m1sk9.dev>2026-08-03 15:12:42 +0900
committerSho Sakuma <me@m1sk9.dev>2026-08-05 01:15:29 +0900
commitdaf9060561656f468a0ae366e5695f5eb74f48f7 (patch)
tree4e096081884cc5039edb198b77d2bd0f70e5751e /platform-paper
parentfd56ebaa1dc2cfa8f834edb06395e8fc02375d1d (diff)
downloadLunaticChat-daf9060561656f468a0ae366e5695f5eb74f48f7.tar.gz
LunaticChat-daf9060561656f468a0ae366e5695f5eb74f48f7.tar.bz2
LunaticChat-daf9060561656f468a0ae366e5695f5eb74f48f7.zip
refactor: make the direct message failure reason an enum
DirectMessageError.reason was a String backed by two constants, so the receiving side matched one case and let everything else fall through to "the target is offline". Adding a third reason on the proxy would have shipped it to Paper servers that silently reported the wrong thing - the one string-keyed dispatch sitting next to a protocol layer whose messages are otherwise a sealed hierarchy with exhaustiveness checking. As an enum, the reader must decide what to show for each case, and CrossServerDirectMessageManager's when no longer needs an else. The wire format is unchanged: kotlinx serializes an enum as its name, so the existing snapshots still decode. What did need care is the reverse direction - a reason from a newer proxy would now fail to parse, where the String version degraded. The property has a default and the codec enables coerceInputValues, so an unknown reason lands on TARGET_OFFLINE, exactly the old else branch. There is a compatibility test for that case. Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'platform-paper')
-rw-r--r--platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/velocity/CrossServerDirectMessageManager.kt2
1 files changed, 1 insertions, 1 deletions
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/velocity/CrossServerDirectMessageManager.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/velocity/CrossServerDirectMessageManager.kt
index ccd8d40..8328ad8 100644
--- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/velocity/CrossServerDirectMessageManager.kt
+++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/velocity/CrossServerDirectMessageManager.kt
@@ -132,7 +132,7 @@ class CrossServerDirectMessageManager(
val messageKey =
when (error.reason) {
PluginMessage.DirectMessageError.Reason.SERVER_NOT_FOUND -> "directMessage.remoteServerNotFound"
- else -> "directMessage.remoteTargetOffline"
+ PluginMessage.DirectMessageError.Reason.TARGET_OFFLINE -> "directMessage.remoteTargetOffline"
}
val text =
languageManager.getMessage(