diff options
| author | Sho Sakuma <me@m1sk9.dev> | 2026-04-04 20:26:37 +0900 |
|---|---|---|
| committer | Sho Sakuma <me@m1sk9.dev> | 2026-04-04 20:26:37 +0900 |
| commit | 2b0829856c9a24b90a9248d28c7de84101b83232 (patch) | |
| tree | 63160192d490543ae7c1fc4a16286397da8261ee /platform-velocity | |
| parent | 9027d9f04fb833f428d6ef528cb19542cef8bd49 (diff) | |
| download | LunaticChat-2b0829856c9a24b90a9248d28c7de84101b83232.tar.gz LunaticChat-2b0829856c9a24b90a9248d28c7de84101b83232.tar.bz2 LunaticChat-2b0829856c9a24b90a9248d28c7de84101b83232.zip | |
feat: Improving Velocity's Cycling Compatibility
Diffstat (limited to 'platform-velocity')
3 files changed, 8 insertions, 11 deletions
diff --git a/platform-velocity/build.gradle.kts b/platform-velocity/build.gradle.kts index f6a4e57..dcd9f9a 100644 --- a/platform-velocity/build.gradle.kts +++ b/platform-velocity/build.gradle.kts @@ -4,6 +4,8 @@ plugins { id("com.gradleup.shadow") } +version = findProperty("velocityVersion")?.toString() ?: "0.0.0" + repositories { maven("https://repo.papermc.io/repository/maven-public/") { name = "papermc-repo" diff --git a/platform-velocity/src/main/kotlin/dev/m1sk9/lunaticChat/velocity/messaging/PluginMessageHandler.kt b/platform-velocity/src/main/kotlin/dev/m1sk9/lunaticChat/velocity/messaging/PluginMessageHandler.kt index 74da9f2..382eba4 100644 --- a/platform-velocity/src/main/kotlin/dev/m1sk9/lunaticChat/velocity/messaging/PluginMessageHandler.kt +++ b/platform-velocity/src/main/kotlin/dev/m1sk9/lunaticChat/velocity/messaging/PluginMessageHandler.kt @@ -84,16 +84,7 @@ class PluginMessageHandler( "Plugin=${handshake.pluginVersion}, Protocol=${handshake.protocolMajor}.${handshake.protocolMinor}.${handshake.protocolPatch}", ) - // Plugin version check (exact match required) - val versionMatch = handshake.pluginVersion == pluginVersion - if (!versionMatch) { - val error = "Plugin version mismatch: Paper=${handshake.pluginVersion}, Velocity=$pluginVersion" - logger.error(error) - sendHandshakeResponse(connection, false, error) - return - } - - // Protocol version check (MAJOR.MINOR must match) + // Protocol version check (MAJOR must match, MINOR within supported range) val protocolCompatible = ProtocolVersion.isCompatible( handshake.protocolMajor, @@ -126,6 +117,9 @@ class PluginMessageHandler( compatible = compatible, velocityVersion = pluginVersion, error = error, + protocolMajor = ProtocolVersion.MAJOR, + protocolMinor = ProtocolVersion.MINOR, + protocolPatch = ProtocolVersion.PATCH, ) val data = PluginMessageCodec.encode(response) diff --git a/platform-velocity/src/test/kotlin/dev/m1sk9/lunaticChat/velocity/messaging/PluginMessageHandlerTest.kt b/platform-velocity/src/test/kotlin/dev/m1sk9/lunaticChat/velocity/messaging/PluginMessageHandlerTest.kt index 876eec6..3342331 100644 --- a/platform-velocity/src/test/kotlin/dev/m1sk9/lunaticChat/velocity/messaging/PluginMessageHandlerTest.kt +++ b/platform-velocity/src/test/kotlin/dev/m1sk9/lunaticChat/velocity/messaging/PluginMessageHandlerTest.kt @@ -69,7 +69,7 @@ class PluginMessageHandlerTest { } @Test - fun `onPluginMessage should reject version mismatch handshake`() { + fun `onPluginMessage should accept different plugin version with matching protocol`() { val (handler, _, _) = createHandler(pluginVersion = "0.10.0") val connection = createServerConnection() @@ -85,6 +85,7 @@ class PluginMessageHandlerTest { handler.onPluginMessage(event) + // Should still send a response (successful handshake) verify { connection.sendPluginMessage(any<ChannelIdentifier>(), any<ByteArray>()) } } |
