Plugin cannot start...

Discussion in 'Plugin Development' started by limjunhyun, Oct 1, 2013.

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

    limjunhyun

    This is my first plugin where im just making a simple troll command... The plugin doesn't even start!
    Here's the Error:
    Code:
    22:01:04 [SEVERE] Could not load 'plugins/Plugin.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
        at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:247)
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:132)
        at org.bukkit.craftbukkit.v1_6_R3.CraftServer.loadPlugins(CraftServer.java:239)
        at org.bukkit.craftbukkit.v1_6_R3.CraftServer.<init>(CraftServer.java:217)
        at net.minecraft.server.v1_6_R3.PlayerList.<init>(PlayerList.java:56)
        at net.minecraft.server.v1_6_R3.DedicatedPlayerList.<init>(SourceFile:11)
        at net.minecraft.server.v1_6_R3.DedicatedServer.init(DedicatedServer.java:107)
        at net.minecraft.server.v1_6_R3.MinecraftServer.run(MinecraftServer.java:393)
        at net.minecraft.server.v1_6_R3.ThreadServerApplication.run(SourceFile:583)
    Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
        ... 9 more
    
    And Here's the code:
    Code:
    package com.gmail.limjunhyun.TestPlugin;
    import org.bukkit.Location;
    import org.bukkit.Server;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Plugin extends JavaPlugin {
        @Override
        public void onEnable(){
            getLogger().info("onEnable has been invoked!");
        }
     
        @Override
        public void onDisable() {
            getLogger().info("onDisable has been invoked!");
        }
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
            if(cmd.getName().equalsIgnoreCase("troll")){ // If the player typed /basic then do the following...
                // doSomething
                Player target = sender.getServer().getPlayer(args[0]);
                if(target==null) {
                    sender.sendMessage(args[0]+" is not online. DERP!");
                    return true;
                }
                target.sendMessage(sender+" is trolling you...");
                float explosionPower = 5F;
                target = ((Server) ((Location) sender).getWorld()).getPlayer(args[0]);
                target.getWorld().createExplosion(target.getLocation(), explosionPower);
            } //If this has happened the function will return true.
                // If this hasn't happened the a value of false will be returned.
            return false;
        }
    }
    
    The yml file, I dunno why it says it doesn't exist...
    Code:
    name: Plugin
    main: com.gmail.limjunhyun.TestPlugin.Plugin
    version: 0.0.1
    author: limjunhyun
    description: -no desc-
    commands:
      basic:
          description: This is a troll command.
          usage: /troll
          permission: Plugin.troll
          permission-message: You lowlifes are not able to use this command...
    
     
  2. limjunhyun Make sure the plugin.yml is in the root of your jar: the error says the plugin.yml isn't present.
     
  3. Offline

    Plo124

    limjunhyun
    You probably put the plugin.yml in with the Plugin.java file (inside the com.gmail.linjunhyun.TestPlugin package), it should be in the root folder, which means its directly in the project, not inside a folder.

    Also, where you state
    description: -no desc-
    you don't have to define every variable in your plugin.yml, you can leave it out if you want, by removing the line.
     
  4. Offline

    limjunhyun

    Errrr... I think I put the plugin.yml in the right place... Here's a picture. bukkit problem.png
     
  5. Offline

    The_Doctor_123

    limjunhyun
    I'm pretty sure that Bukkit is case sensitive when loading the file. Change the name to "plugin.yml."
     
  6. Underneath author: take out the description: bukkit confuses that description with a command description.
     
  7. Offline

    Goblom

    You have to many spaces under "commands.basic". Should be like this.
    Code:
    commands:
      basic:
        description: This is a troll command.
        usage: /troll
        permission: Plugin.troll
        permission-message: You lowlifes are not able to use this command...
    YAML is very picky.
    • No spaces = top level
    • 2 spaces = 2nd level
    • 4 spaces = 3rd level
    • 6 spaces = 4th level
    You had 6 spaces under "commands.basic" but YAML processed them correctly but Bukkit didn't know how read them. (My understanding)
     
  8. Offline

    limjunhyun

    thx!

    Ouch.... now there's another problem...
    Here's what the console shows.
    Code:
    09:05:58 [SEVERE] Could not load 'plugins/Plugin.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: name is not defined
        at org.bukkit.plugin.PluginDescriptionFile.loadMap(PluginDescriptionFile.java:801)
        at org.bukkit.plugin.PluginDescriptionFile.<init>(PluginDescriptionFile.java:188)
        at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:252)
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:132)
        at org.bukkit.craftbukkit.v1_6_R3.CraftServer.loadPlugins(CraftServer.java:239)
        at org.bukkit.craftbukkit.v1_6_R3.CraftServer.<init>(CraftServer.java:217)
        at net.minecraft.server.v1_6_R3.PlayerList.<init>(PlayerList.java:56)
        at net.minecraft.server.v1_6_R3.DedicatedPlayerList.<init>(SourceFile:11)
        at net.minecraft.server.v1_6_R3.DedicatedServer.init(DedicatedServer.java:107)
        at net.minecraft.server.v1_6_R3.MinecraftServer.run(MinecraftServer.java:393)
        at net.minecraft.server.v1_6_R3.ThreadServerApplication.run(SourceFile:583)
    Caused by: java.lang.NullPointerException
        at org.bukkit.plugin.PluginDescriptionFile.loadMap(PluginDescriptionFile.java:795)
        ... 10 more
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  9. Offline

    Goblom

    Remove "description: -no desc-"

    Yaml also thinks that "-" means a list

    If you don't have a description removing the line doesn't do anything to the plugin
     
  10. Offline

    limjunhyun

    I removed it, and got the error above...
     
Thread Status:
Not open for further replies.

Share This Page