Solved ProtocolLib ProtocolManager is null

Discussion in 'Spigot Plugin Development' started by Hunky524, Dec 5, 2020.

  1. I'm not sure if I am just missing something, but I couldn't seem to find any info about others with this problem.
    Whenever I try to access the protocollib manager, the manager is null. It's possible I've missed something, but no where in any docs do I see that I need to initialize it anywhere.

    When I run this short example:
    Code (Text):

        private lateinit var protocolManager: ProtocolManager

        override fun onLoad() {
            protocolManager = ProtocolLibrary.getProtocolManager()
    I get this stacktrace:
    Code (Text):
    [13:11:36 ERROR]: [org.bukkit.craftbukkit.v1_16_R3.CraftServer] ProtocolLibrary.getProtocolManager() must not be null initializing IociaCraftCore v1.0.0 (Is it up to date?)
    java.lang.NullPointerException: ProtocolLibrary.getProtocolManager() must not be null
            at iocianetwork.iociacraft.iociacraftcore.IociaCraftCoreMain.onLoad(IociaCraftCoreMain.kt:28) ~[?:?]
            at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins( ~[patched_1.16.4.jar:git-Paper-298]
            at net.minecraft.server.v1_16_R3.DedicatedServer.init( ~[patched_1.16.4.jar:git-Paper-298]
            at net.minecraft.server.v1_16_R3.MinecraftServer.w( ~[patched_1.16.4.jar:git-Paper-298]
            at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0( ~[patched_1.16.4.jar:git-Paper-298]
            at [?:?]
    Do I need to manually initialize it somehow? No example I saw about it leads to believe that I do.
  2. you're declaring on load. do you have protocollib to be a depend/softdepend? chances are youre trying to grab the manager before protocollib has even had time to create it yet. add protocollib as a depend/softdepend or move the declaration to the onEnable
    • Winner Winner x 1
  3. Ahh ok, I just assumed I could shade it into my JAR file, but I guess I have to add it to the plugins folder, and add it as a dependency. Thanks
  4. oh. yeah no. protocollib has to run as a plugin, you cant shade it