diff options
| author | Sho Sakuma <me@m1sk9.dev> | 2026-09-28 22:21:21 +0900 |
|---|---|---|
| committer | Sho Sakuma <me@m1sk9.dev> | 2026-09-28 22:21:21 +0900 |
| commit | 9601f147dd38d5fc93d8fff118794990f44c3766 (patch) | |
| tree | c2ef667c80d8594c43b245651f0cc0a3771d5ef4 /website/src/ja/docs/developers | |
| parent | a1679bdd2a4904b288964f0b90ee9af569aed5c2 (diff) | |
| download | LunaticChat-9601f147dd38d5fc93d8fff118794990f44c3766.tar.gz LunaticChat-9601f147dd38d5fc93d8fff118794990f44c3766.tar.bz2 LunaticChat-9601f147dd38d5fc93d8fff118794990f44c3766.zip | |
refactor(paper): render chat formats through one placeholder vocabulary
Placeholder names were spelled as string literals in three handlers, and
each handler also chose its own way of turning the result into a
Component. Adding a placeholder meant finding every call site by hand, with
nothing to catch a format left without its value.
ChatPlaceholder now owns the names, and each format has an entry point whose
parameters are exactly the placeholders it accepts, so the compiler points
at the callers when one is added. Substitution happens in a single pass, so
a value that itself contains "{message}" is no longer replaced again by the
next placeholder. All three formats now deserialize section signs into
styles, which leaves what players see unchanged.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'website/src/ja/docs/developers')
| -rw-r--r-- | website/src/ja/docs/developers/platform-paper.md | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/website/src/ja/docs/developers/platform-paper.md b/website/src/ja/docs/developers/platform-paper.md index e291bcf..930c696 100644 --- a/website/src/ja/docs/developers/platform-paper.md +++ b/website/src/ja/docs/developers/platform-paper.md @@ -158,6 +158,7 @@ config フラグ - `Language` (enum) — `EN` / `JA`.未知コードは EN にフォールバック - `LanguageManager` — 起動時に `resources/languages/` を KAML でロードし,ネストした YAML をドット記法 (`toggle.on` 等) にフラット化する.`getMessage(key, placeholders)` は 選択言語 → EN フォールバック で解決し `{placeholder}` を置換,未発見はキー自身を返す.EN が無ければ致命エラー - `MessageFormatter` (`object`) — `[LC]` プレフィックス付きの Adventure `Component` を生成し,`{braces}` プレースホルダを正規表現で検出して色分けする +- `ChatPlaceholder` / `ChatFormat.kt` — `messageFormat` のプレースホルダ語彙と唯一のレンダラ.フォーマットごとの入口 (`directMessage` / `channelMessage` / `crossServerGlobalChat`) が 1 パスで置換し,結果を `LegacyComponentSerializer` に渡す.ハンドラがプレースホルダ名を綴ることはない ## converter — ローマ字→日本語変換 |
