diff options
| author | Sho Sakuma <me@m1sk9.dev> | 2026-08-30 20:43:36 +0900 |
|---|---|---|
| committer | Sho Sakuma <me@m1sk9.dev> | 2026-08-30 20:43:36 +0900 |
| commit | 85fad9cf81c45b16dc9d0c3310bdbf0eea694723 (patch) | |
| tree | 4ec19f53943fc5bf10b917de9758e7bf3562d620 /engine/src | |
| parent | 64197733346bbcabc3daa65f6648c1a21e26b328 (diff) | |
| download | LunaticChat-85fad9cf81c45b16dc9d0c3310bdbf0eea694723.tar.gz LunaticChat-85fad9cf81c45b16dc9d0c3310bdbf0eea694723.tar.bz2 LunaticChat-85fad9cf81c45b16dc9d0c3310bdbf0eea694723.zip | |
feat(paper): make the debug switch categorised, live and dumpable
config.yml now accepts `debug: velocity,protocol` and a block with `enabled` and
`categories` beside the boolean it always took. Categories exist so that
instrumenting the chat path does not bury the handshake an operator is chasing
under one line per message.
The setting is read by inspecting the YAML node by hand rather than through a
data class, because one key has to accept both a scalar and a map and kaml picks
the input to build from the descriptor kind alone - a class descriptor rejects
`debug: true` before the serializer is ever called. An unknown category name is
collected rather than thrown: throwing would make ConfigManager prune the whole
`debug` key and switch off the categories the operator did spell correctly.
`debug` moves from RESTART_REQUIRED to applied, since a reload only has to
replace a DebugState. `/lc debug` switches a category for the running server and
deliberately does not write config.yml back - re-emitting a commented YAML
document from a parsed tree loses every comment and every bit of formatting the
operator put there, and a restart or `/lc reload` putting the file back in charge
is the safer default anyway.
`/lc dump` writes the report a bug report needs: versions, enabled features,
connection state and how full each store is. It carries no message text, player
name or UUID, because it exists to be pasted into a public issue by someone who
is not reading it first. Its reply names the file relative to the server
directory - the command can be granted to someone with no filesystem access, to
whom an absolute path discloses where the server is installed and nothing they
can act on.
The KtorSimpleLogger calls in ChannelMessageHandler and ChannelMessageLogger are
folded into the same logger, so there is one place that decides whether a
diagnostic line is printed.
Refs #228
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'engine/src')
2 files changed, 10 insertions, 2 deletions
diff --git a/engine/src/main/kotlin/dev/m1sk9/lunaticChat/engine/permission/LunaticChatPermissionNode.kt b/engine/src/main/kotlin/dev/m1sk9/lunaticChat/engine/permission/LunaticChatPermissionNode.kt index d12bb2d..9831b3c 100644 --- a/engine/src/main/kotlin/dev/m1sk9/lunaticChat/engine/permission/LunaticChatPermissionNode.kt +++ b/engine/src/main/kotlin/dev/m1sk9/lunaticChat/engine/permission/LunaticChatPermissionNode.kt @@ -15,6 +15,10 @@ sealed class LunaticChatPermissionNode( object Reload : LunaticChatPermissionNode("lunaticchat.command.lc.reload") + object Debug : LunaticChatPermissionNode("lunaticchat.command.lc.debug") + + object Dump : LunaticChatPermissionNode("lunaticchat.command.lc.dump") + object Channel : LunaticChatPermissionNode("lunaticchat.command.lc.channel") object ChannelCreate : LunaticChatPermissionNode("lunaticchat.command.lc.channel.create") diff --git a/engine/src/test/kotlin/dev/m1sk9/lunaticChat/engine/permission/LunaticChatPermissionNodeTest.kt b/engine/src/test/kotlin/dev/m1sk9/lunaticChat/engine/permission/LunaticChatPermissionNodeTest.kt index 39f2604..e5e43cb 100644 --- a/engine/src/test/kotlin/dev/m1sk9/lunaticChat/engine/permission/LunaticChatPermissionNodeTest.kt +++ b/engine/src/test/kotlin/dev/m1sk9/lunaticChat/engine/permission/LunaticChatPermissionNodeTest.kt @@ -13,6 +13,8 @@ class LunaticChatPermissionNodeTest { LunaticChatPermissionNode.Settings, LunaticChatPermissionNode.Status, LunaticChatPermissionNode.Reload, + LunaticChatPermissionNode.Debug, + LunaticChatPermissionNode.Dump, LunaticChatPermissionNode.Channel, LunaticChatPermissionNode.ChannelCreate, LunaticChatPermissionNode.ChannelList, @@ -45,8 +47,8 @@ class LunaticChatPermissionNodeTest { } @Test - fun `should have 25 permission nodes`() { - assertEquals(25, allNodes.size) + fun `should have 27 permission nodes`() { + assertEquals(27, allNodes.size) } @Test @@ -56,6 +58,8 @@ class LunaticChatPermissionNodeTest { assertEquals("lunaticchat.command.reply", LunaticChatPermissionNode.Reply.permissionNode) assertEquals("lunaticchat.command.lc.settings", LunaticChatPermissionNode.Settings.permissionNode) assertEquals("lunaticchat.command.lc.reload", LunaticChatPermissionNode.Reload.permissionNode) + assertEquals("lunaticchat.command.lc.debug", LunaticChatPermissionNode.Debug.permissionNode) + assertEquals("lunaticchat.command.lc.dump", LunaticChatPermissionNode.Dump.permissionNode) assertEquals("lunaticchat.command.lc.channel.create", LunaticChatPermissionNode.ChannelCreate.permissionNode) assertEquals("lunaticchat.command.lcv.status", LunaticChatPermissionNode.VelocityStatus.permissionNode) assertEquals("lunaticchat.spy", LunaticChatPermissionNode.Spy.permissionNode) |
