[solved] Error with CB 1467

Discussion in 'Plugin Development' started by Darazo, Nov 20, 2011.

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

    Darazo

    I'm getting the following error with my plugin on CB 1467, and I can't seem to figure out what the problem is.
    Code:
    2011-11-20 14:29:35 [SEVERE] Error occurred while enabling LimitIP v1.1 (Is it up to date?): null
    java.lang.NullPointerException
        at org.bukkit.plugin.java.JavaPlugin.getResource(JavaPlugin.java:156)
        at org.bukkit.plugin.java.JavaPlugin.reloadConfig(JavaPlugin.java:133)
        at org.bukkit.plugin.java.JavaPlugin.getConfig(JavaPlugin.java:125)
        at me.darazo.limitip.LimitIP.onEnable(LimitIP.java:38)
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:183)
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:957)
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:280)
        at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:176)
        at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:159)
        at net.minecraft.server.MinecraftServer.t(MinecraftServer.java:337)
        at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:324)
        at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:161)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:388)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:457)
    It seems to indicate a problem with my onEnable method, but I fail to see what the problem could be. This is my onEnable method:
    Code:
        @Override
        public void onEnable() {
            PluginManager pm = getServer().getPluginManager();
            pm.registerEvent(Event.Type.PLAYER_PRELOGIN, this.playerListener, Priority.Monitor, this);
            PluginDescriptionFile pdffile = this.getDescription();
            this.logger.info(pdffile.getName() + " v" + pdffile.getVersion() + " enabled.");
            config = getConfig();
        }
    I was not getting any errors with CB 1337, so I can only assume something has changed in the latest build of bukkit. Any assistance would be appreciated.
     
  2. Offline

    Nitnelave

    Which line is n° 38? If it's the event registering one, check that you did declare and initialise your listener first.
     
  3. Offline

    theguynextdoor

    What exactly is line 38?
     
  4. Offline

    ScreamingAmish

    I'm having the exact same problem. Specifically, I can not seem to getConfig() if the config file does not exist. Instead of generating a FileConfiguration it returns null. My line that generates the error is the getConfig():

    Code:
        public void onEnable() {
            config = getConfig();
            PluginDescriptionFile desc = getDescription();
     
  5. Offline

    kikoto

    I have the same problem too:

    [SEVERE] Error occurred while enabling ..... (Is it up to date?)
     
  6. Offline

    Darazo

    I have identified the problem is indeed regarding getConfig(). I found that including a default config.yml in the plugin will solve this problem, so I guess including a default config file is now required by bukkit.
     
  7. Offline

    ScreamingAmish

    That was exactly it, thanks!
     
  8. Offline

    herghost

    I had this as well, do your commands work after this fix?
     
  9. Offline

    Darazo

    Everything works as it should after this fix, yes.
     
  10. Offline

    Fishrock123

  11. Offline

    Darazo

Thread Status:
Not open for further replies.

Share This Page