ProtocolLib

3M Downloads

ProtocolManager is always null

JustKatze opened this issue ยท 4 comments

commented

Hey I'm getting this error from the ProtocolManager idk why this happens

Error:

[18:17:20 ERROR]: Error occurred while enabling ImmersiveWorld v1.0 (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "com.comphenix.protocol.ProtocolManager.getMinecraftVersion()" because the return value of "com.comphenix.protocol.ProtocolLibrary.getProtocolManager()" is null
at net.holy.ImmersiveWorlds.onEnable(ImmersiveWorlds.java:55) ~[ImmersiveWorlds-1.0.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:542) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:565) ~[paper-1.19.2.jar:git-Paper-307]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:479) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:636) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:422) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:306) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1100) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-307]
at java.lang.Thread.run(Thread.java:833) ~[?:?]

@Override
    public void onEnable() {
        System.out.println(ProtocolLibrary.getProtocolManager().getMinecraftVersion().toString());
        protocolManager = ProtocolLibrary.getProtocolManager();
}

The protocolManager is always null

ProtocolLib Version: 5.0.0
Server and Plugin Version: 1.19.2 Latest

commented

typically this happens either when you don't declare PL as a dependency in your plugin yml or if you're shading PL into your jar

commented

So in your case, try adding <scope>provided</scope> to the ProtocolLib dependency

commented
<repository>
            <id>dmulloy2-repo</id>
            <url>https://repo.dmulloy2.net/repository/public/</url>
</repository>

<dependency>
            <groupId>com.comphenix.protocol</groupId>
            <artifactId>ProtocolLib</artifactId>
            <version>5.0.0</version>
</dependency>
commented

Fixed it thank you for your help