CloudNetService / CloudNet

A modern application that can dynamically and easily deliver Minecraft oriented software
https://cloudnetservice.eu
Apache License 2.0
371 stars 115 forks source link

Kyori Adventure not usable in more than one Bungeecord/Waterfall plugin #1171

Open itsTyrion opened 1 year ago

itsTyrion commented 1 year ago

Stacktrace

[Proxy-1] [21:07:20 ERROR]: [/185.17.205.220:11020|IchKnuddelDich] -> UpstreamBridge - encountered exception
[Proxy-1] java.lang.LinkageError: loader constraint violation: loader net.md_5.bungee.api.plugin.PluginClassloader @17430f69 wants to load interface net.kyori.adventure.text.Component. A different interface with the same name was previously loaded by net.md_5.bungee.api.plugin.PluginClassloader @6aa5581c. (net.kyori.adventure.text.Component is in unnamed module of loader net.md_5.bungee.api.plugin.PluginClassloader @6aa5581c, parent loader 'app')
[Proxy-1]    at de.itsTyrion.crashtest.bungee.cmd.Ping.execute(Ping.kt:25) ~[?:?]
[Proxy-1]    at net.md_5.bungee.api.plugin.PluginManager.dispatchCommand(PluginManager.java:213) ~[waterfall.jar:git:Waterfall-Bootstrap:1.19-R0.1-SNAPSHOT:8a03f3d:515]

Actions to reproduce

Use adventure-platform-bungee in one plugin (shaded ofc), do something with adventure components in another plugin depending on the first one.

Tested with a basic default setup, a Lobby server (Purpur 1.19.3 for CN4, Paper 1.19.2 for CN3), and static waterfall-latest.

CN3 image CN4 image

The mini plugin I reproduced this with can be found here: https://github.com/itsTyrion/crashtest - I uploaded the compiled release incl the plugin with all the kotlin libs in releases. For builds gradle buildArtifacts builds and collects the artifacts in a dist folder but gradle jar in both modules works too.

Kotlin isn't shaded with the current config tho - and it works in all plugins. made a 2nd branch that shades kotlin and uploaded that as as release, too

CloudNet version

INFO:
INFO: CloudNet Blizzard 4.0.0-RC8 7ea69a0a
INFO: Discord: <https://discord.cloudnetservice.eu/>
INFO:
INFO: ClusterId: 3eee53da-****-4de9-****-a04504515c93
INFO: NodeId: srv01
INFO: Head-NodeId: srv03
INFO: CPU usage: (P/S) 5.13/16.81/100%
INFO: Node services memory allocation (U/R/M): 8192/8192/15000 MB
INFO: Threads: 54
INFO: Heap usage: 46/256MB
INFO: JVM: Debian 17 (OpenJDK 64-Bit Server VM 17.0.6+10-Debian-1deb11u1)
INFO: Update Repo: CloudNetService/launchermeta, Update Branch: beta
INFO:

Other

No response

Issue uniqueness

alessiobrendt commented 1 year ago

I also have this problem

itsTyrion commented 1 year ago

Solvable by using an older version of MiniMessage (4.12.0) and adventure-platform-bungeecord (4.2.0)

e: nevermind it's not :(

kxmpxtxnt commented 1 year ago

an temporary fix for this is maybe just using velocity instead :) but I will take a look at this

kxmpxtxnt commented 1 year ago

an temporary fix for this is maybe just using velocity instead :) but I will take a look at this

well actually this looks like a classloader bug which has nothing in common with cloudnet

itsTyrion commented 1 year ago

Solution: downgrade adventure-platform-bungeecord to a version that matches cloudnet and shade it but exclude adventure-api. Yes, even if the version matches CloudNet's version.

derklaro commented 1 year ago

This is very likely a BungeeCord issue. This error does not occur on other platforms. But if exclusion works go with it I guess. The shaded version of adventure was bumped to latest in the nightly builds :)