feat: 添加 lettuce-core 用于连接 redis
All checks were successful
Publish Project / build (push) Successful in 2m43s

This commit is contained in:
2025-07-03 02:29:02 +08:00
parent 0f942a7687
commit 1648a56453
11 changed files with 95 additions and 22 deletions

View File

@@ -0,0 +1,21 @@
// lettuce-core 需要使用 netty但低版本 bukkit 服务端核心自带的 netty 版本 lettuce 需要的版本有冲突
// 所以必须 shadow 并 relocate 依赖 io.netty才能保证两个版本互不冲突
// 但由于 core-bukkit 同时也 shadow 了 adventure-platform-bukkit且 adventure 内部通过反射调用 netty
// 如果在 core-bukkit 中直接 relocate netty会导致 adventure 的反射调用也指向 relocate 后的 netty
// 此时会导致 shadow 后的 adventure 与服务端中其他同样需要使用 netty 的插件关联时发生冲突
// 例如:服务端上安装了 ViaVersion 时core-bukkit 内置的 adventure 将会与其发生冲突
// 因为 adventure 使用 relocate 之后的类路径ViaVersion 在将类转换成原版 netty 类时,会发生 ClassCastException
// 所以只能先将 lettuce-core 与其需要的 netty 一起打包,并 relocate netty然后再使 core-bukkit 依赖这个打包后的版本
// 才能使得 adventure 与 lettuce-core 正常运行
dependencies {
implementation("io.lettuce:lettuce-core:6.7.1.RELEASE") {
exclude(group = "org.slf4j")
}
}
tasks {
shadowJar {
relocate("io.netty", "cn.hamster3.mc.plugin.core.lib.io.netty")
}
}