diff options
| author | Sho Sakuma <me@m1sk9.dev> | 2026-02-11 05:56:17 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-11 05:56:17 +0900 |
| commit | 944342294fb574caed734944c739231b372ca163 (patch) | |
| tree | a19835d67a8cd62d95e41d853e371f13004c78d2 | |
| parent | 0032eeeb52492070f34faeba2b2ab62250e777ca (diff) | |
| parent | 71f63153304dc17a5c5a5ba9625397be6287edb6 (diff) | |
| download | LunaticChat-944342294fb574caed734944c739231b372ca163.tar.gz LunaticChat-944342294fb574caed734944c739231b372ca163.tar.bz2 LunaticChat-944342294fb574caed734944c739231b372ca163.zip | |
Merge pull request #99 from m1sk9/improve/lcv-status-commandv0.9.0
feat: UI/UX Improvements for the `/lcv status` Command
| -rw-r--r-- | CHANGELOG.md | 9 | ||||
| -rw-r--r-- | build.gradle.kts | 2 | ||||
| -rw-r--r-- | docker/compose.yaml | 5 | ||||
| -rw-r--r-- | docs/src/en/guide/admin/velocity.md | 35 | ||||
| -rw-r--r-- | docs/src/en/reference/permissions.md | 54 | ||||
| -rw-r--r-- | docs/src/guide/admin/velocity.md | 34 | ||||
| -rw-r--r-- | docs/src/reference/permissions.md | 6 | ||||
| -rw-r--r-- | platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/ServiceInitializer.kt | 15 | ||||
| -rw-r--r-- | platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lcv/VelocityStatusCommand.kt | 189 | ||||
| -rw-r--r-- | platform-paper/src/main/resources/languages/en.yml | 23 | ||||
| -rw-r--r-- | platform-paper/src/main/resources/languages/ja.yml | 22 | ||||
| -rw-r--r-- | platform-velocity/src/main/kotlin/dev/m1sk9/lunaticChat/velocity/LunaticChat.kt | 15 | ||||
| -rwxr-xr-x | x | 11 |
13 files changed, 274 insertions, 146 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ebe45c..ee7970e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,16 @@ ## v0 -### v0.8.1 +### v0.9.0 - Modrinth releases are now split per Loader. +- Allow LunaticChat for Velocity to run standalone when launch fails due to version mismatch +- Prevent `/lcv status` from becoming disabled when Velocity integration fails due to version mismatch +- Enable checking Velocity integration errors via `/lcv status` +- Add hover text to `/lcv status` indicating current integration status +- Fixed an issue where metadata linked to the Velocity version of LunaticChat build was incorrect. +- Enabled execution of `/lcv status` from the console. + - Live status display requires the Player API and is therefore not supported. ### v0.8.0 diff --git a/build.gradle.kts b/build.gradle.kts index b0155d3..73e1c27 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,7 +14,7 @@ plugins { allprojects { group = "dev.m1sk9" - version = "0.8.1" + version = "0.9.0" repositories { mavenCentral() diff --git a/docker/compose.yaml b/docker/compose.yaml index f11bf95..2f3d5c9 100644 --- a/docker/compose.yaml +++ b/docker/compose.yaml @@ -6,8 +6,7 @@ services: - "25577:25577" volumes: - lunatic-debug-velocity-data:/server - - ../platform-velocity/build/libs:/plugins:ro - - ./plugins-velocity:/data/plugins + - ./plugins-velocity:/server/plugins - ./velocity.toml:/server/velocity.toml environment: TYPE: "VELOCITY" @@ -36,7 +35,6 @@ services: - "25575:25575" volumes: - lunatic-debug-s1-data:/data - - ../platform-paper/build/libs:/plugins:ro - ./plugins-paper-s1:/data/plugins - ./bukkit.yml:/data/bukkit.yml environment: @@ -84,7 +82,6 @@ services: - "25576:25575" volumes: - lunatic-debug-s2-data:/data - - ../platform-paper/build/libs:/plugins:ro - ./plugins-paper-s2:/data/plugins - ./bukkit.yml:/data/bukkit.yml environment: diff --git a/docs/src/en/guide/admin/velocity.md b/docs/src/en/guide/admin/velocity.md index 6a4e6f7..e1f9aa0 100644 --- a/docs/src/en/guide/admin/velocity.md +++ b/docs/src/en/guide/admin/velocity.md @@ -21,13 +21,8 @@ To enable Velocity integration, follow these steps: For Velocity and Paper's LunaticChat to integrate correctly, both plugin versions and protocol versions must be compatible. - Ensure that the LunaticChat versions on Velocity and Paper sides are the same. - - Generally, the same version of LunaticChat is compatible. - - Releases are made simultaneously for Velocity and Paper versions, so version numbers will not differ. - - However, compatibility may not be guaranteed when using beta or development versions. + - Compatibility may not be guaranteed when using beta or development versions. - Ensure that protocol versions match. - - LunaticChat uses protocol versions to ensure compatibility between different versions. - - Verify that the protocol versions of LunaticChat on Velocity and Paper sides match. - - Note that when protocol versions change, it is considered a **breaking change**, requiring simultaneous updates of both Velocity and Paper versions of LunaticChat. ::: danger Regarding LunaticChat versions prior to v0.7.0 @@ -37,34 +32,36 @@ They cannot be used together, so if you are using LunaticChat prior to v0.7.0, d ::: -::: tip Version Rules +## How to Check Integration Status + +To verify that Velocity integration is working properly, use the `/lcv status` command. + +The current protocol version and connection state will be displayed. + +::: warning Behavior When Versions Mismatch -LunaticChat follows these version rules: +When the version or protocol version does not match, the Velocity integration feature is disabled, but **the plugin itself continues to operate**. -- Plugin version: Exact match required - - Paper 0.7.0, Velocity 0.7.0 → ✓ PASS - - Paper 0.7.0, Velocity 0.6.0 → ✗ FAIL -- Protocol version: MAJOR.MINOR must match - - Paper 1.0.0, Velocity 1.0.1 → ✓ PASS (PATCH difference is OK) - - Paper 1.0.0, Velocity 1.1.0 → ✗ FAIL (MINOR difference) - - Paper 1.0.0, Velocity 2.0.0 → ✗ FAIL (MAJOR difference) +You can check the connection state and error details using the `/lcv status` command. To reconnect, ensure that the LunaticChat version / protocol version on Velocity and Paper sides match. ::: -## How to Check Integration Status +::: tip About Velocity Integration Timing -To verify that Velocity integration is working properly, use the `/lcv status` command. +LunaticChat connects to Velocity **when the first player joins the server** after startup. -The current protocol version and connection state will be displayed. +Therefore, if you run the `/lcv status` command immediately after server startup, the Velocity integration may not be established yet. + +::: ## Troubleshooting If you encounter issues with Velocity integration, check the following: +- **Run the `/lcv status` command to check the connection state**. If there are errors such as version mismatches, an error message will be displayed. - Ensure that the LunaticChat version / protocol version on Velocity and Paper sides are the same. - Verify that LunaticChat settings are correct. - Ensure that network connection between Velocity server and Paper servers is working properly. -- Check LunaticChat logs for error messages or warnings. ## Cross-Server Chat diff --git a/docs/src/en/reference/permissions.md b/docs/src/en/reference/permissions.md index 65825c1..4508808 100644 --- a/docs/src/en/reference/permissions.md +++ b/docs/src/en/reference/permissions.md @@ -20,6 +20,12 @@ Receives LunaticChat update notifications. [You must have `checkForUpdates` enabled](../guide/admin/configuration.md#checkforupdates) to receive notifications. +### `lunaticchat.channelbypass` + +- Default: `OP` + +Bypasses moderation features and restrictions on private channels. + ## `lunaticchat.command.*` ### `lunaticchat.command.tell` @@ -94,12 +100,54 @@ Toggles the use of the [`/lc channel switch`](commands/lc/channel.md) command. Toggles the use of the [`/lc channel status`](commands/lc/channel.md) command. +### `lunaticchat.command.lc.channel.info` + +- Default: `non OP` + +Toggles the use of the [`/lc channel info`](commands/lc/channel.md) command. + ### `lunaticchat.command.lc.channel.delete` - Default: `non OP` Toggles the use of the [`/lc channel delete`](commands/lc/channel.md) command. +### `lunaticchat.command.lc.channel.invite` + +- Default: `non OP` + +Toggles the use of the [`/lc channel invite`](commands/lc/channel.md) command. + +### `lunaticchat.command.lc.channel.kick` + +- Default: `non OP` + +Toggles the use of the [`/lc channel kick`](commands/lc/channel.md) command. + +### `lunaticchat.command.lc.channel.ban` + +- Default: `non OP` + +Toggles the use of the [`/lc channel ban`](commands/lc/channel.md) command. + +### `lunaticchat.command.lc.channel.unban` + +- Default: `non OP` + +Toggles the use of the [`/lc channel unban`](commands/lc/channel.md) command. + +### `lunaticchat.command.lc.channel.mod` + +- Default: `non OP` + +Toggles the use of the [`/lc channel mod`](commands/lc/channel.md) command. + +### `lunaticchat.command.lc.channel.ownership` + +- Default: `non OP` + +Toggles the use of the [`/lc channel ownership`](commands/lc/channel.md) command. + ### `lunaticchat.command.lc.chatmode` - Default: `non OP` @@ -112,6 +160,12 @@ Toggles the use of the [`/lc chatmode`](commands/lc/chatmode.md) command. Toggles the use of the [`/lc chatmode toggle`](commands/lc/chatmode.md) command. +### `lunaticchat.command.lcv.status` + +- Default: `OP` + +Toggles the use of the [`/lcv status`](commands/lcv/status.md) command. + ### `lunaticchat.command.jp` <Badge type="danger" text="Deprecated: Will be removed in v1.0.0" /> - Default: `non OP` diff --git a/docs/src/guide/admin/velocity.md b/docs/src/guide/admin/velocity.md index d6de2c6..2b07ddb 100644 --- a/docs/src/guide/admin/velocity.md +++ b/docs/src/guide/admin/velocity.md @@ -21,13 +21,8 @@ Velocity 連携を有効化するには以下の手順を行います: Velocity と Paper の LunaticChat が正しく連携するには,両方のプラグインバージョン・プロトコルバージョンが互換性のあるものである必要があります. - Velocity 側と Paper 側の LunaticChat のバージョンが同じであることを確認してください. - - 基本的に,同じバージョンの LunaticChat は互換性があります. - - リリースは Velocity 版・Paper 版 で同時に行われるため,バージョン番号が異なることはありません. - - ただし,ベータ版や開発版を使用している場合,互換性が保証されないことがあります. + - ベータ版や開発版を使用している場合,互換性が保証されないことがあります. - プロトコルバージョンが一致していることを確認してください. - - LunaticChat は,異なるバージョン間での互換性を確保するために,プロトコルバージョンを使用しています. - - Velocity 側と Paper 側の LunaticChat のプロトコルバージョンが一致していることを確認してください. - - なお,プロトコルバージョンが変わる場合は **破壊的変更** に当たるため,Paper 版の LunaticChat のアップデート時に Velocity 版の LunaticChat も同時にアップデートする必要があります. ::: danger v0.7.0 未満の LunaticChat について @@ -37,30 +32,33 @@ v0.7.0 未満の LunaticChat は Velocity 版との後方互換性はありま ::: -::: tip バージョンルール +## 連携状況の確認方法 + +Velocity 連携が正常に動作しているか確認するには,`/lcv status` コマンドを使用します. + +現在のプロトコルバージョンと接続状態が表示されます. + +::: warning バージョン不一致時の動作 -LunaticChat は以下のバージョンルールに従います. +バージョンやプロトコルバージョンが一致しない場合,Velocity 連携機能は無効化されますが,**プラグイン自体は動作を継続します**. -- プラグインバージョン: 完全一致が必要 - - Paper 0.7.0, Velocity 0.7.0 → ✓ PASS - - Paper 0.7.0, Velocity 0.6.0 → ✗ FAIL -- プロトコルバージョン: MAJOR.MINOR が一致する必要あり - - Paper 1.0.0, Velocity 1.0.1 → ✓ PASS (PATCH の違いは OK) - - Paper 1.0.0, Velocity 1.1.0 → ✗ FAIL (MINOR の違い) - - Paper 1.0.0, Velocity 2.0.0 → ✗ FAIL (MAJOR の違い) +`/lcv status` コマンドで接続状態とエラー内容を確認できます.再接続するには Velocity 側と Paper 側の LunaticChat のバージョン / プロトコルバージョンを一致させてください. ::: -## 連携状況の確認方法 +::: tip Velocity との連携タイミングについて -Velocity 連携が正常に動作しているか確認するには,`/lcv status` コマンドを使用します. +LunaticChat が Velocity と連携するタイミングは,起動後 **最初のプレイヤーがサーバーに接続したとき** に行われます. -現在のプロトコルバージョンと接続状態が表示されます. +そのため,サーバー起動直後に `/lcv status` コマンドを実行しても,まだ Velocity との連携が確立されていない場合があります. + +::: ## トラブルシューティング Velocity 連携に関する問題が発生した場合,以下の点を確認してください: +- **`/lcv status` コマンドを実行して接続状態を確認してください**.バージョン不一致などのエラーがある場合は,エラーメッセージが表示されます. - Velocity 側と Paper 側の LunaticChat のバージョン / プロトコルバージョンが同じであることを確認してください. - LunaticChat の設定が正しいことを確認してください. - Velocity サーバーと Paper サーバー間のネットワーク接続が正常であることを確認してください. diff --git a/docs/src/reference/permissions.md b/docs/src/reference/permissions.md index fb30a36..5704a50 100644 --- a/docs/src/reference/permissions.md +++ b/docs/src/reference/permissions.md @@ -160,6 +160,12 @@ LunaticChat のアップデート通知を受け取ります. [`/lc chatmode toggle`](commands/lc/chatmode.md) コマンドの使用を切り替えます. +### `lunaticchat.command.lcv.status` + +- Default: `OP` + +[`/lcv status`](commands/lcv/status.md) コマンドの使用を切り替えます. + ### `lunaticchat.command.jp` <Badge type="danger" text="非推奨: v1.0.0 で削除予定" /> - Default: `non OP` diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/ServiceInitializer.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/ServiceInitializer.kt index dc015ed..0af6ed8 100644 --- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/ServiceInitializer.kt +++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/ServiceInitializer.kt @@ -395,24 +395,13 @@ class ServiceInitializer( } is VelocityConnectionManager.HandshakeResult.Error -> { logger.severe("Velocity handshake failed: ${result.message}") - logger.severe("Disabling plugin due to Velocity integration failure") - plugin.server.scheduler.runTask( - plugin, - Runnable { - plugin.server.pluginManager.disablePlugin(plugin) - }, - ) + logger.severe("Velocity integration is disabled. Use /lcv status to check the status.") } } }.exceptionally { throwable -> logger.severe("Velocity handshake exception: ${throwable.message}") + logger.severe("Velocity integration is disabled. Use /lcv status to check the status.") throwable.printStackTrace() - plugin.server.scheduler.runTask( - plugin, - Runnable { - plugin.server.pluginManager.disablePlugin(plugin) - }, - ) null } } diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lcv/VelocityStatusCommand.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lcv/VelocityStatusCommand.kt index a4fb838..6ebb4f4 100644 --- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lcv/VelocityStatusCommand.kt +++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lcv/VelocityStatusCommand.kt @@ -7,7 +7,6 @@ import dev.m1sk9.lunaticChat.engine.protocol.ProtocolVersion import dev.m1sk9.lunaticChat.paper.LunaticChat import dev.m1sk9.lunaticChat.paper.command.annotation.Command import dev.m1sk9.lunaticChat.paper.command.annotation.Permission -import dev.m1sk9.lunaticChat.paper.command.annotation.PlayerOnly import dev.m1sk9.lunaticChat.paper.command.core.CommandContext import dev.m1sk9.lunaticChat.paper.command.core.LunaticCommand import dev.m1sk9.lunaticChat.paper.i18n.LanguageManager @@ -16,6 +15,7 @@ import dev.m1sk9.lunaticChat.paper.velocity.VelocityConnectionManager import io.papermc.paper.command.brigadier.CommandSourceStack import io.papermc.paper.command.brigadier.Commands import net.kyori.adventure.text.Component +import net.kyori.adventure.text.event.HoverEvent import net.kyori.adventure.text.format.NamedTextColor /** @@ -29,7 +29,6 @@ import net.kyori.adventure.text.format.NamedTextColor description = "Velocity integration status", ) @Permission(LunaticChatPermissionNode.VelocityStatus::class) -@PlayerOnly class VelocityStatusCommand( plugin: LunaticChat, private val velocityConnectionManager: VelocityConnectionManager, @@ -46,15 +45,14 @@ class VelocityStatusCommand( .literal("status") .executes { ctx -> val context = wrapContext(ctx) - checkPlayerOnly(context)?.let { return@executes handleResult(context, it) } - val result = execute(context) handleResult(context, result) }, ) private fun execute(ctx: CommandContext): CommandResult { - val sender = ctx.requirePlayer() + val sender = ctx.sender + val player = ctx.player val meta = plugin.pluginMeta // Connection state @@ -62,96 +60,133 @@ class VelocityStatusCommand( val stateMessage = when (state) { VelocityConnectionManager.ConnectionState.DISCONNECTED -> { - Component.text("Disconnected", NamedTextColor.GRAY) + Component + .text(languageManager.getMessage("velocity.state.disconnected"), NamedTextColor.GRAY) + .hoverEvent( + HoverEvent.showText( + Component.text(languageManager.getMessage("velocity.hoverInfo.disconnected"), NamedTextColor.GRAY), + ), + ) } VelocityConnectionManager.ConnectionState.HANDSHAKING -> { - Component.text("Handshaking...", NamedTextColor.YELLOW) + Component + .text(languageManager.getMessage("velocity.state.handshaking"), NamedTextColor.YELLOW) + .hoverEvent( + HoverEvent.showText( + Component.text(languageManager.getMessage("velocity.hoverInfo.handshaking"), NamedTextColor.YELLOW), + ), + ) } VelocityConnectionManager.ConnectionState.CONNECTED -> { - Component.text("Connected", NamedTextColor.GREEN) + Component + .text(languageManager.getMessage("velocity.state.connected"), NamedTextColor.GREEN) + .hoverEvent( + HoverEvent.showText( + Component.text(languageManager.getMessage("velocity.hoverInfo.connected"), NamedTextColor.GREEN), + ), + ) } VelocityConnectionManager.ConnectionState.FAILED -> { - Component.text("Failed", NamedTextColor.RED) + Component + .text(languageManager.getMessage("velocity.state.failed"), NamedTextColor.RED) + .hoverEvent( + HoverEvent.showText( + Component.text(languageManager.getMessage("velocity.hoverInfo.failed"), NamedTextColor.RED), + ), + ) } } - // Header - sender.sendMessage( - MessageFormatter.format( - languageManager.getMessage("velocity.status.header"), - ), - ) - - // Paper plugin version - sender.sendMessage( - Component - .text(" • ", NamedTextColor.GRAY) - .append(Component.text("Paper Version: ", NamedTextColor.GRAY)) - .append(Component.text(meta.version, NamedTextColor.AQUA)), - ) - - // Protocol version - sender.sendMessage( - Component - .text(" • ", NamedTextColor.GRAY) - .append(Component.text("Protocol Version: ", NamedTextColor.GRAY)) - .append(Component.text(ProtocolVersion.version, NamedTextColor.AQUA)), - ) - - // Connection state - sender.sendMessage( - Component - .text(" • ", NamedTextColor.GRAY) - .append(Component.text("Connection State: ", NamedTextColor.GRAY)) - .append(stateMessage), - ) - - // Velocity version (if connected) - velocityConnectionManager.getVelocityVersion()?.let { velocityVersion -> - sender.sendMessage( + val connectionStatus: List<Component?> = + listOf( + // Paper plugin version Component .text(" • ", NamedTextColor.GRAY) - .append(Component.text("Velocity Version: ", NamedTextColor.GRAY)) - .append(Component.text(velocityVersion, NamedTextColor.AQUA)), - ) - } - - // Error message (if failed) - velocityConnectionManager.getLastError()?.let { error -> - sender.sendMessage( + .append(Component.text("${languageManager.getMessage("velocity.status.label.paperVersion")}: ", NamedTextColor.GRAY)) + .append(Component.text(meta.version, NamedTextColor.AQUA)), + // Velocity version (if connected) + velocityConnectionManager.getVelocityVersion()?.let { velocityVersion -> + Component + .text(" • ", NamedTextColor.GRAY) + .append( + Component.text("${languageManager.getMessage("velocity.status.label.velocityVersion")}: ", NamedTextColor.GRAY), + ).append(Component.text(velocityVersion, NamedTextColor.AQUA)) + }, + // Protocol version Component .text(" • ", NamedTextColor.GRAY) - .append(Component.text("Error: ", NamedTextColor.GRAY)) - .append(Component.text(error, NamedTextColor.RED)), + .append(Component.text("${languageManager.getMessage("velocity.status.label.protocolVersion")}: ", NamedTextColor.GRAY)) + .append(Component.text(ProtocolVersion.version, NamedTextColor.AQUA)), + // Connection state + Component + .text(" • ", NamedTextColor.GRAY) + .append(Component.text("${languageManager.getMessage("velocity.status.label.connectionState")}: ", NamedTextColor.GRAY)) + .append(stateMessage), + // Error message (if failed) + velocityConnectionManager.getLastError()?.let { error -> + Component + .text(" • ", NamedTextColor.GRAY) + .append(Component.text("${languageManager.getMessage("velocity.status.error")}: ", NamedTextColor.GRAY)) + .append(Component.text(error, NamedTextColor.RED)) + }, + ) + + sender.apply { + // Header + sendMessage( + MessageFormatter.format( + languageManager.getMessage("velocity.status.header"), + ), ) + // Connection status details + connectionStatus.forEach { line -> + line?.let { sendMessage(it) } + } } - // Live status check (if connected) + // Live status check (only available for players when connected) if (state == VelocityConnectionManager.ConnectionState.CONNECTED) { - sender.sendMessage( - Component - .text(" • ", NamedTextColor.GRAY) - .append(Component.text("Checking live status...", NamedTextColor.YELLOW)), - ) + if (player != null) { + sender.sendMessage( + Component + .text(" • ", NamedTextColor.GRAY) + .append(Component.text(languageManager.getMessage("velocity.status.checkingLiveStatus"), NamedTextColor.YELLOW)), + ) - velocityConnectionManager - .requestStatus(sender) - .thenAccept { response -> - sender.sendMessage( - Component - .text(" ✓ ", NamedTextColor.GREEN) - .append(Component.text("Online Players: ", NamedTextColor.GRAY)) - .append(Component.text(response.online.toString(), NamedTextColor.YELLOW)), - ) - }.exceptionally { throwable -> - sender.sendMessage( - Component - .text(" ✗ ", NamedTextColor.RED) - .append(Component.text("Live status check failed: ", NamedTextColor.GRAY)) - .append(Component.text(throwable.message ?: "Unknown error", NamedTextColor.RED)), - ) - null - } + velocityConnectionManager + .requestStatus(player) + .thenAccept { response -> + sender.sendMessage( + Component + .text(" ✓ ", NamedTextColor.GREEN) + .append( + Component.text( + "${languageManager.getMessage("velocity.status.label.onlinePlayers")}: ", + NamedTextColor.GRAY, + ), + ).append(Component.text(response.online.toString(), NamedTextColor.YELLOW)), + ) + }.exceptionally { throwable -> + sender.sendMessage( + Component + .text(" ✗ ", NamedTextColor.RED) + .append( + Component.text( + "${languageManager.getMessage("velocity.status.liveStatusFailed")}: ", + NamedTextColor.GRAY, + ), + ).append(Component.text(throwable.message ?: "Unknown error", NamedTextColor.RED)), + ) + null + } + } else { + // Console cannot perform live status check + sender.sendMessage( + Component + .text(" • ", NamedTextColor.GRAY) + .append(Component.text(languageManager.getMessage("velocity.status.consoleNoLiveStatus"), NamedTextColor.GRAY)), + ) + } } return CommandResult.Success diff --git a/platform-paper/src/main/resources/languages/en.yml b/platform-paper/src/main/resources/languages/en.yml index f19c494..e3dcf91 100644 --- a/platform-paper/src/main/resources/languages/en.yml +++ b/platform-paper/src/main/resources/languages/en.yml @@ -198,14 +198,25 @@ toggle: on: "Enabled" velocity: + state: + disconnected: "Disconnected" + handshaking: "Handshaking..." + connected: "Connected" + failed: "Failed" status: header: "--- LunaticChat Velocity Cooperation Status ---" - paperVersion: "Paper Plugin Version: v{version}" - velocityVersion: "Velocity Plugin Version: v{version}" - protocolVersion: "Protocol Version: v{version}" - connectionState: "Connection State" error: "Error" checkingLiveStatus: "Checking live status..." - liveStatusSuccess: "Live status: Velocity v{version}, Protocol v{protocol}, Online: {online}" liveStatusFailed: "Live status check failed" - + consoleNoLiveStatus: "Live status check is not available from console (execute as a player)" + label: + paperVersion: "Paper Version" + velocityVersion: "Velocity Version" + protocolVersion: "Protocol Version" + connectionState: "Connection State" + onlinePlayers: "Online Players" + hoverInfo: + disconnected: "The connection between LunaticChat and the Velocity server is disconnected. A server restart is required to reconnect" + handshaking: "Currently establishing connection between LunaticChat and the Velocity server" + connected: "LunaticChat is successfully connected to the Velocity server" + failed: "Failed to establish connection between LunaticChat and the Velocity server. You need to resolve the error to reconnect" diff --git a/platform-paper/src/main/resources/languages/ja.yml b/platform-paper/src/main/resources/languages/ja.yml index ed02f5a..e9894f1 100644 --- a/platform-paper/src/main/resources/languages/ja.yml +++ b/platform-paper/src/main/resources/languages/ja.yml @@ -198,13 +198,25 @@ toggle: off: "無効" velocity: + state: + disconnected: "切断済み" + handshaking: "ハンドシェイク中..." + connected: "接続済み" + failed: "接続失敗" status: header: "--- LunaticChat Velocity 連携ステータス ---" - paperVersion: "Paper プラグインバージョン: v{version}" - velocityVersion: "Velocity プラグインバージョン: v{version}" - protocolVersion: "プロトコルバージョン: v{version}" - connectionState: "接続状態" error: "エラー" checkingLiveStatus: "ライブステータスを確認中..." - liveStatusSuccess: "ライブステータス: Velocity v{version}, プロトコル v{protocol}, オンライン: {online}" liveStatusFailed: "ライブステータスチェックに失敗しました" + consoleNoLiveStatus: "ライブステータスチェックはコンソールからは利用できません (プレイヤーとして実行してください)" + label: + paperVersion: "Paper バージョン" + velocityVersion: "Velocity バージョン" + protocolVersion: "プロトコルバージョン" + connectionState: "接続状態" + onlinePlayers: "オンラインプレイヤー" + hoverInfo: + disconnected: "LunaticChat と Velocity サーバ間の接続が切断されています。再接続するにはサーバを再起動する必要があります" + handshaking: "現在 LunaticChat と Velocity サーバ間の接続を確立中です" + connected: "LunaticChat は Velocity サーバと正常に接続されています" + failed: "LunaticChat と Velocity サーバ間の接続に失敗しました。再接続するにはエラーを解決する必要があります" diff --git a/platform-velocity/src/main/kotlin/dev/m1sk9/lunaticChat/velocity/LunaticChat.kt b/platform-velocity/src/main/kotlin/dev/m1sk9/lunaticChat/velocity/LunaticChat.kt index 77b8c97..be5a4cd 100644 --- a/platform-velocity/src/main/kotlin/dev/m1sk9/lunaticChat/velocity/LunaticChat.kt +++ b/platform-velocity/src/main/kotlin/dev/m1sk9/lunaticChat/velocity/LunaticChat.kt @@ -5,6 +5,7 @@ import com.velocitypowered.api.event.Subscribe import com.velocitypowered.api.event.proxy.ProxyInitializeEvent import com.velocitypowered.api.event.proxy.ProxyShutdownEvent import com.velocitypowered.api.plugin.Plugin +import com.velocitypowered.api.plugin.PluginContainer import com.velocitypowered.api.proxy.ProxyServer import dev.m1sk9.lunaticChat.velocity.messaging.CrossServerChatRelay import dev.m1sk9.lunaticChat.velocity.messaging.PluginMessageHandler @@ -14,11 +15,14 @@ import org.slf4j.Logger * LunaticChat Velocity plugin * * Handles plugin messaging in coordination with Paper servers. + * + * Note: The version in this annotation is not used at runtime. + * The actual version is loaded from velocity-plugin.json via PluginContainer. */ @Plugin( id = "lunaticchat", name = "LunaticChat", - version = "0.8.0", + version = "0.0.0", description = "Next-generation channel chat plugin for Paper/Velocity", url = "https://lc.m1sk9.dev", authors = ["m1sk9"], @@ -28,6 +32,7 @@ class LunaticChat constructor( private val server: ProxyServer, private val logger: Logger, + private val pluginContainer: PluginContainer, ) { private var messageHandler: PluginMessageHandler? = null private var crossServerChatRelay: CrossServerChatRelay? = null @@ -36,6 +41,12 @@ class LunaticChat fun onProxyInitialization(event: ProxyInitializeEvent) { logger.info("Initializing LunaticChat Velocity plugin") + // Get plugin version from velocity-plugin.json (via PluginContainer) + val pluginVersion = + pluginContainer.description.version.orElseThrow { + IllegalStateException("Plugin version not found in velocity-plugin.json") + } + // Initialize cross-server chat relay crossServerChatRelay = CrossServerChatRelay( @@ -49,7 +60,7 @@ class LunaticChat plugin = this@LunaticChat, server = server, logger = logger, - pluginVersion = "0.8.0", + pluginVersion = pluginVersion, crossServerChatRelay = crossServerChatRelay!!, ) messageHandler?.initialize() @@ -10,6 +10,7 @@ Usage: ./x <command> [options] Commands: start Build with gradlew and start docker compose + start-s1 Build Paper and start only s1 container restart Restart s1, s2 and velocity containers stop Stop docker compose clean Stop docker compose and remove volumes @@ -26,8 +27,18 @@ EOF case "${1:-}" in start) ./gradlew :platform-paper:clean :platform-paper:shadowJar :platform-velocity:clean :platform-velocity:shadowJar + # Copy built JARs to plugin directories + cp platform-paper/build/libs/*.jar docker/plugins-paper-s1/ + cp platform-paper/build/libs/*.jar docker/plugins-paper-s2/ + cp platform-velocity/build/libs/*.jar docker/plugins-velocity/ $DOCKER_COMPOSE up ;; + start-s1) + ./gradlew :platform-paper:clean :platform-paper:shadowJar + # Copy built JAR to s1 plugin directory + cp platform-paper/build/libs/*.jar docker/plugins-paper-s1/ + $DOCKER_COMPOSE up s1 + ;; restart) $DOCKER_COMPOSE restart s1 s2 velocity ;; |
