Solved createConfig() returns NullPointerException?

Discussion in 'Plugin Help/Development/Requests' started by xXSon588Xx, Dec 31, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    xXSon588Xx

    So basically I have a config system that uses createConfig() to create a config. However, it keeps returning null when the server starts, resulting in a crash.

    My base class: http://pastebin.com/ZEyXKggk
    My Config class: http://pastebin.com/1B35auJP
    My error: http://pastebin.com/Yz0KXPPB

    I have another class that creates a player.yml, but I'm assuming it will create the same error.

    I tried using the config setup on the Bukkit Wiki but that even game me NullPointerException.

    I am completely stump.
     
  2. Offline

    xXSon588Xx

    @Juancomaster1998
    I know it's null, but for some odd reason I can't figure out why. (Very sleepy right now and I just want to get this finished.)
     
  3. configFile = new File(plugin.getDataFolder(), "config.yml");
    add that before checking if configFile exists
     
  4. Offline

    xXSon588Xx

    @Juancomaster1998

    If you look in the config class at line 35, I already added that.
     
  5. @xXSon588Xx
    yes, but if you want to use that, you must call MCEP_Config first.
    you`re calling createConfigs before of MCEP_Config. So configFile still being null.
     
  6. Offline

    Lionhard

    @xXSon588Xx Are that 2 different plugins? Why do all your classes extend JavaPlugin?
     
  7. Offline

    xXSon588Xx

    @Lionhard

    No, it's just 1 plugin. I must've been very tired when I wrote that. I removed the JavaPlugin extension from MCEP_Configs.

    @Juancomaster1998

    I see what you're trying to say. Going to fix that now to see if the results change.

    Still having bad luck. I changed the Config file to how it is on the Bukkit wiki but I'm still getting an error. MCEP_Config is called before I believe and I don't know what else to do.

    Main: http://pastebin.com/WZqu69VS
    Config: http://pastebin.com/0izPKXed

    Edit: Fixed the error.

    -Closed-

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Oct 31, 2016
Thread Status:
Not open for further replies.

Share This Page