ProtocolLib

3M Downloads

PacketAdapter

Kai-Denzel-Jane opened this issue ยท 7 comments

commented

Make sure you're doing the following

  • [Y] You're using the latest build for your server version
  • [~] This isn't an issue caused by another plugin
  • [Y] You've checked for duplicate issues
  • [Y] You didn't use /reload

Describe the question
Why am I getting the following error when I have ProtocolLib in the Projects dependencies and the JAR file is in the plugins folder:

[19:27:29 ERROR]: Error occurred while enabling ClientInfo v1.0 (Is it up to date?) java.lang.NoClassDefFoundError: com/comphenix/protocol/events/PacketAdapter at java.base/java.lang.ClassLoader.defineClass1(Native Method) ~[?:?] at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027) ~[?:?] at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150) ~[?:?] at io.papermc.paper.plugin.entrypoint.classloader.PaperSimplePluginClassLoader.findClass(PaperSimplePluginClassLoader.java:103) ~[purpur-1.21.4.jar:1.21.4-2376-4bf1b98] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593) ~[?:?] at io.papermc.paper.plugin.entrypoint.classloader.PaperPluginClassLoader.loadClass(PaperPluginClassLoader.java:118) ~[purpur-1.21.4.jar:1.21.4-2376-4bf1b98] at io.papermc.paper.plugin.entrypoint.classloader.PaperPluginClassLoader.loadClass(PaperPluginClassLoader.java:107) ~[purpur-1.21.4.jar:1.21.4-2376-4bf1b98] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[?:?] at ClientInfo-1.0-SNAPSHOT.jar/net.kaijane.clientInfo.ClientInfo.onEnable(ClientInfo.java:15) ~[ClientInfo-1.0-SNAPSHOT.jar:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:288) ~[purpur-api-1.21.4-R0.1-SNAPSHOT.jar:?] at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:202) ~[purpur-1.21.4.jar:1.21.4-2376-4bf1b98] at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:109) ~[purpur-1.21.4.jar:1.21.4-2376-4bf1b98] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:520) ~[purpur-api-1.21.4-R0.1-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.CraftServer.enablePlugin(CraftServer.java:669) ~[purpur-1.21.4.jar:1.21.4-2376-4bf1b98] at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:618) ~[purpur-1.21.4.jar:1.21.4-2376-4bf1b98] at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:772) ~[purpur-1.21.4.jar:1.21.4-2376-4bf1b98] at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:534) ~[purpur-1.21.4.jar:1.21.4-2376-4bf1b98] at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:369) ~[purpur-1.21.4.jar:1.21.4-2376-4bf1b98] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1251) ~[purpur-1.21.4.jar:1.21.4-2376-4bf1b98] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:344) ~[purpur-1.21.4.jar:1.21.4-2376-4bf1b98] at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?] Caused by: java.lang.ClassNotFoundException: com.comphenix.protocol.events.PacketAdapter at io.papermc.paper.plugin.entrypoint.classloader.PaperPluginClassLoader.loadClass(PaperPluginClassLoader.java:146) ~[purpur-1.21.4.jar:1.21.4-2376-4bf1b98] at io.papermc.paper.plugin.entrypoint.classloader.PaperPluginClassLoader.loadClass(PaperPluginClassLoader.java:107) ~[purpur-1.21.4.jar:1.21.4-2376-4bf1b98] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[?:?] ... 21 more

API method(s) used
PacketAdapter

Expected behavior
My plugin sees ProtocolLib and its classes resulting in it not failing to enable the plugin

Code
https://github.com/Kai-Denzel-Jane/ClientInfo

commented

Also check if ProtocolLib supports the current server version that you're using.

commented

Aren't you shading ProtocolLib?

commented

Your repo is not available so we cannot see your source code.

commented

Your repo is not available so we cannot see your source code.

Sorry about that its now public forget making repos from IntelliJ are Private by default

commented

Set ProtocolLib as compileOnly dependency.

commented
repositories {
    maven { url "https://repo.dmulloy2.net/repository/public/" }
}

dependencies {
    compileOnly 'com.comphenix.protocol:ProtocolLib:5.1.0'
}
commented

its happening the same for me with every packet listener. NoClassDefFound and my plugin gets unloaded. I have ProtoclLib as a Dependency on my build.gradle and installed on my server, and it keeps throwing me that exception.