Spigot 1.16.5 plugin is null?

Discussion in 'Spigot Help' started by Ultrajungleboy, Jul 13, 2021.

  1. Hi everyone this is my first time seeking help- I'm unaware of why this issue is happening its been working until I recently updated my jar file- on my old server jar this works just fine I'm also not the most experienced coder so maybe I'm doing something wrong here that shouldn't have worked in the first place.
    This is the error message i get-
    Code (Java):
    [23:13:06] [Server thread/WARN]: [UltraStory] Task #3428 for UltraStory v1.0 generated an exception
    java.lang.NullPointerException: Cannot invoke "org.bukkit.plugin.java.JavaPlugin.getDataFolder()" because "eu.crushedpixel.camerastudio.CameraStudio.instance" is null
        at me.ultrajungleboy.ultrastory.tasks.Travel.travel(Travel.java:42) ~[?:?]
        at me.ultrajungleboy.ultrastory.tasks.Travel.run(Travel.java:35) ~[?:?]
        at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:100) ~[patched_1.16.5.jar:git-Tuinity-"901ac35"]
        at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:468) ~[patched_1.16.5.jar:git-Tuinity-"901ac35"]
        at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1489) ~[patched_1.16.5.jar:git-Tuinity-"901ac35"]
        at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:437) ~[patched_1.16.5.jar:git-Tuinity-"901ac35"]
        at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1402) ~[patched_1.16.5.jar:git-Tuinity-"901ac35"]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1134) ~[patched_1.16.5.jar:git-Tuinity-"901ac35"]
        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:292) ~[patched_1.16.5.jar:git-Tuinity-"901ac35"]
        at java.lang.Thread.run(Thread.java:832) [?:?]
    This is where the variable is

    This is where I'm getting the variable

    The part that I don't understand is that the plugin works fine on its own- it can access the instance variable with no problem but for some weird reason it says it's null when being accessed through my plugin.

    Thank you all
  2. Do you have a depend/softdepend set in the UltraStory plugin.yml for CameraStudio? It sounds like your plugin may be loading first, before CameraStudio has set its instance variable.
  3. Thank you for the reply-yes it is a depend in my plugin.yml and this error occurs after all the plugins are loaded - so the load order shouldn’t matter at that point right? I will try to make sure CameraStudio loads first and reply to you with the results.
    Code (Text):
    [01:56:18] [Server thread/INFO]: [CPCameraStudioReborn] Loading CPCameraStudioReborn v1.4.2
    [01:56:18] [Server thread/INFO]: [renametool] Loading renametool v2.1
    [01:56:18] [Server thread/INFO]: [CensorReloaded] Loading CensorReloaded v4.0.4
    [01:56:18] [Server thread/INFO]: [VoxelSniper] Loading VoxelSniper v6.1.2
    [01:56:18] [Server thread/INFO]: [LuckPerms] Loading LuckPerms v5.3.51
    [01:56:18] [Server thread/INFO]: [CrackShot] Loading CrackShot v0.98.9
    [01:56:18] [Server thread/INFO]: [spark] Loading spark v1.4.3
    [01:56:18] [Server thread/INFO]: [InfiniteAnnouncements] Loading InfiniteAnnouncements v1.6.1
    [01:56:18] [Server thread/INFO]: [UltraStory] Loading UltraStory v1.0
    [01:56:18] [Server thread/INFO]: [BlackMarket] Loading BlackMarket v1.0
    So it appears CameraStudio is loading before UltraStory
    #3 Ultrajungleboy, Jul 13, 2021
    Last edited: Jul 13, 2021
  4. Ok, the real question would technically be which is enabling first since CameraStudio sets the instance variable in onEnable, but since you have set a depend you should be good there. Could you post the code where you register the Travel runnable class?
  5. I believe this is what you're talking about
    Code (Java):
    else if(args[0].equalsIgnoreCase("travel")){
                    if(args.length < 5){
                        sender.sendMessage("/ultrastory travel player time filename delay");
                        return false;
                    BukkitTask travel = new Travel(player, args[2], args[3]).runTaskLater(mainPlugin, Long.parseLong(args[4]));

    And UltraStory is enabling after CameraStudio I'm going to try a few more things to pinpoint where the issue might be.

    I don't understand why an update of the server jar would cause a variable to be null when it wasn't before.