My plugin breaks on .yml file?

Discussion in 'Plugin Development' started by blaatz0r, Feb 28, 2011.

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

    blaatz0r

    I've been away from Bukkit for a while and now my plugins have broken since the latest releases, but I can't seem to fix it:

    Code:
    17:42:27 [SEVERE] Could not load plugins\Trivia.jar in plugins: null
    org.bukkit.plugin.InvalidPluginException
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:80)
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:129)
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:94)
            at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:59)
            at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:204)
            at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:191)
            at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:131)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:246)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)
    Caused by: java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
            at java.lang.reflect.Constructor.newInstance(Unknown Source)
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:76)
            ... 8 more
    Caused by: java.lang.NullPointerException
            at nl.blaatz0r.Trivia.Trivia.<init>(Trivia.java:40)
            ... 13 more
    This error tells me nothing [​IMG]

    Code:
    public final String name = this.getDescription().getName();
    This hints at the plugin.yml file, but there seems to be nothing wrong with that.

    Code:
    name: Trivia
    main: nl.blaatz0r.Trivia.Trivia
    description: Trivia is a quiz game that is played in the minecraft chatbox.
    version: 1.5
    
    commands:
        trivia:
            description: Trivia related commands
            usage: /trivia help
    
        next:
            description: Skips to the next Trivia question
            usage: /<command>
            
        votenext:
            description: Calls a vote for the next Trivia question
            usage: /<command>
            
        hint:
            description: Calls the next hint for the current Trivia question, if possible
            usage: /<command>


    Code is here: https://github.com/TuinCraft/Trivia
     
  2. Offline

    Plague

    Can you have empty lines there and didn't you use tabs?
     
  3. Offline

    Dutchy

    I've ben debugging blaatz0r's code and it all runs fine if we put the getDescription calls in onEnable. Is this because of the recent constructor change, is the PluginDescription only set right before onEnable?
     
  4. Offline

    blaatz0r

    Fixed thanks to Dutchy.

    Solution: The name and description variables should be initialized in the onEnable function.
     
Thread Status:
Not open for further replies.

Share This Page