// 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") } }