# GhostDisplays Paper 1.21.10 向けの不可視ディスプレイ制御ライブラリです。TextDisplay / BlockDisplay / ItemDisplay をプレイヤー単位で表示・クリック検知できるようにし、ゴースト化した UI やガイドラインをサーバー側で柔軟に提供できます。 ## 提供機能 - `DisplayService` による Text/Block/Item Display の生成 API - `DisplayController` を介した `Player#showEntity` / `hideEntity` の参照カウント管理 - `AudiencePredicate`/`AudiencePredicates` による可視対象の自動同期(ログイン・ワールド移動・リスポーンで再評価) - Interaction エンティティを用いたクリック判定サポートと、優先度付きクリックハンドラー - まとめて `destroyAll()` できるリソース管理 ## スタンドアロンでの使い方 プラグインを `plugins/` に配置して起動すると `/ghostdisplay` コマンドが利用できます。デフォルトで OP のみ実行可能ですが、`ghostdisplays.command.*` を付与すると通常権限でも操作できます。 | コマンド | 説明 | | --- | --- | | `/ghostdisplay create text ` | プレイヤー視点の約 1.5 ブロック先に TextDisplay を生成し、即座にチャット編集モードへ。次に送信したメッセージ(または `cancel`)が内容になります。 | | `/ghostdisplay create block ` | BlockDisplay を生成します。`oak_planks[facing=north]` のような `BlockData` 文字列を指定してください。 | | `/ghostdisplay create item ` | ItemDisplay を生成します。`minecraft:stick` などのアイテム ID を受け付けます。 | | `/ghostdisplay text edit ` | 既存の TextDisplay をチャット入力で編集。`cancel` で破棄。単語のみで良い場合は `/ghostdisplay text set Hello_World` のように `_` をスペースに変換して即時更新できます。 | | `/ghostdisplay viewer add|remove ` | 任意のプレイヤーまたはセレクターを表示対象に追加/削除します。`/ghostdisplay viewer clear ` で全員解除。 | | `/ghostdisplay audience permission add ` | 指定パーミッションを持つプレイヤーに自動表示 (`remove` で解除)。 | | `/ghostdisplay audience near set ` | Display 周囲の半径プレイヤーへ自動表示 (`audience clear` で全自動表示を解除)。 | | `/ghostdisplay list` / `/ghostdisplay info ` | 登録済み Display の一覧、情報(座標 / Viewers / Audiences / 内容)を表示。 | | `/ghostdisplay delete ` | Display を完全に削除します。 | ## 技術的ポイント - Paper 標準 API の `setVisibleByDefault(false)` + `showEntity`/`hideEntity` を採用し、ProtocolLib に依存しない設計 - Display / Interaction は `setPersistent(false)` でスポーンし、サーバーリロードやチャンクアンロードに強い - Predicate ごとにアクティブなプレイヤー集合を持つため、複数条件での重複表示にも対応 - クリック検知は `PlayerInteractEntityEvent` を介して Display/Interaction 双方から観測し、ハンドラーは Kotlin DSL で登録可能 - Kotlin 2.2 + ShadowJar + plugin-yml 生成を使い、`./gradlew build`でそのまま Paper に投入可能なJarを生成 ## 同梱ライブラリ - コマンド定義は `kommand-lib`(Kotlin DSL)を使用し、`permits-lib` と連携して `ghostdisplays.command.*` のパーミッションツリーを自動生成しています。 - どちらも本リポジトリの `kommand-lib/` 以下にサブモジュールとして含まれており、`./gradlew build` 時に一緒にコンパイルされます。