Solved InvalidPluginException

Discussion in 'Plugin Development' started by Blackwing_Forged, Aug 20, 2017.

Thread Status:
Not open for further replies.
  1. I've tried looking everywhere and found no solution, I don't know what's causing this error
    The error says Line 11 which is the start of my onEnable method.

    Error:
    https://pastebin.com/Hj1t4g9C
    onEnable:
    Code:
    public void onEnable()
       {
            if(!getDataFolder().exists())
                getDataFolder().mkdir();
    
            if(getConfig() == null)
            {
                getConfig().addDefault("Swords", 0);
                getConfig().addDefault("Axes", 0);
                getConfig().addDefault("Bow", 0);
                saveDefaultConfig();
                getConfig().options().copyDefaults();
            }
           
            registerEvents();
        }
     
  2. Offline

    Zombie_Striker

    @Blackwing_Forged
    Can you post the full class? The error message states that you are trying to get an object from a static initialize, which is not something the code posted is doing.
     
  3. @Zombie_Striker
    would it be this:
    static Plugin pl = DamageMain.getPlugin(DamageMain.class);

    EDIT: I got it, i looked up better ways to get the plugin instance and that worked, thanks anyway :)
     
    Last edited: Aug 20, 2017
Thread Status:
Not open for further replies.

Share This Page