org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml

Discussion in 'Plugin Development' started by samTB, May 20, 2021.

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

    samTB

    help me im coding a hello command plugin and my project doesnt work here is the error:
    Code:
    [Server thread/ERROR]: Could not load 'plugins\hello.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
            at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:160) ~[spigot.jar:2991-Spigot-018b9a0-f3f3094]
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:144) [spigot.jar:2991-Spigot-018b9a0-f3f3094]
            at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:383) [spigot.jar:2991-Spigot-018b9a0-f3f3094]
            at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:185) [spigot.jar:2991-Spigot-018b9a0-f3f3094]
            at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:809) [spigot.jar:2991-Spigot-018b9a0-f3f3094]
            at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:164) [spigot.jar:2991-Spigot-018b9a0-f3f3094]
            at net.minecraft.server.v1_16_R3.MinecraftServer$$Lambda$3231/1515971318.run(Unknown Source) [spigot.jar:2991-Spigot-018b9a0-f3f3094]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_51]
    Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
            ... 8 more
    
    and here is my code for the Main:
    Code:
    package me.samTB.hello;
    
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Main extends JavaPlugin {
        @Override
        public void onEnable() {
            super.onEnable();
        }
    
        @Override
        public void onDisable() {
            super.onDisable();
        }
    
        @Override
        public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
            if (label.equalsIgnoreCase("hello")) {
                if (sender instanceof Player) {
                    Player p = (Player) sender;
                    if (p.hasPermission("hello.use")) {
                        p.sendMessage(ChatColor.translateAlternateColorCodes('&',
                                "&1h&ae&el&dl&co&o"+p.getDisplayName()));
                        return true;
                    }
                    p.sendMessage(ChatColor.translateAlternateColorCodes('&',
                            "&e[!]&cYou do not have permission to use this command"));
                    return true;
                } sender.sendMessage("Hi console!");
                return true;
            }
            return false;
        }
    }
    
    and my plugin.yml:
    Code:
      name: hello
      main: me.samTB.hello.Main
      version: 1.0
      author: sam
      description: hi!
      commands:
        hello:
          usage: /<command>
          aliases: hi
    and my project pic and im using intellij:
    upload_2021-5-20_14-2-37.png
    plls help
     

    Attached Files:

    Last edited: May 20, 2021
  2. Offline

    timtower Administrator Administrator Moderator

    @samTB Post the full error please
     
  3. Offline

    davidclue

    @samTB It's because you put spaces in front of your lines in your plugin.yml so change it to this:
    Code:
    name: hello
    main: me.samTB.hello.Main
    version: 1.0
    author: sam
    description: hi!
    api-version: 1.16
    
    commands:
        hello:
            usage: /<command>
            aliases: hi
    It's a good idea to include API version in your plugins yml, and also when you are putting sub-components into your yml for example your 'hello:' you put 4 spaces for the format.
     
Thread Status:
Not open for further replies.

Share This Page