Solved Can't load my plugin

Discussion in 'Plugin Development' started by Arbuzik999, Feb 2, 2018.

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

    Arbuzik999

    I'm making a plugin.
    When I'm starting my server, there is an error

    Code:
    [14:22:36] [Server thread/ERROR]: Could not load 'plugins\WarnCommands_1.12.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
        at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:152) ~[spigot-1.12.2.jar:git-Spigot-3d850ec-809c399]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:133) [spigot-1.12.2.jar:git-Spigot-3d850ec-809c399]
        at org.bukkit.craftbukkit.v1_12_R1.CraftServer.loadPlugins(CraftServer.java:306) [spigot-1.12.2.jar:git-Spigot-3d850ec-809c399]
        at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:205) [spigot-1.12.2.jar:git-Spigot-3d850ec-809c399]
        at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:545) [spigot-1.12.2.jar:git-Spigot-3d850ec-809c399]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_121]
    Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
        ... 6 more
    [14:22:36] [Server thread/INFO]: Set PluginClassLoader as parallel capable
    plugin.yml:

    Code:
    name: WarnCommands
    main: com.warncommands.Main
    version: Alpha 1.0
    author: Arbuzik999
    description: WarnCommands
    
    commands:
        warn:
            description: Info about WarnCommands.
            permissions: warncommands.warn
            usage: /<command>
          
    permissions:
        com.warncommands.warn:
            description: Allows to /warn.
    
     
  2. Offline

    timtower Administrator Administrator Moderator

    @Arbuzik999
    Code:
    Jar does not contain plugin.yml
    You aren't exporting the plugin.yml with it.
     
  3. Offline

    Arbuzik999

  4. Offline

    timtower Administrator Administrator Moderator

    @Arbuzik999 It is not in the jar, the plugin.yml should be in WarnCommands, not in the source folder.
     
  5. Offline

    Arbuzik999

    The same thing..
     
  6. Offline

    timtower Administrator Administrator Moderator

  7. Offline

    Arbuzik999

    upload_2018-2-2_16-22-18.png

    This error is when I trying to add a command. When I'm removing command from plugin.yml, it is working.
     
    Last edited by a moderator: Feb 2, 2018
  8. Offline

    timtower Administrator Administrator Moderator

  9. Offline

    Arbuzik999

  10. Offline

    timtower Administrator Administrator Moderator

    Next time please scroll all the way down for the latest errors.
    You have tabs in your plugin.yml, you can't have those. Replace them with spaces.
     
  11. Offline

    Arbuzik999

    It doesn't work. Tried to replace it manually. Even set the option in Notepad++

    upload_2018-2-2_16-36-27.png

    Also Eclipse sends me this error, but when I reclicking the "Finish" button, there is no error.
     
    Last edited by a moderator: Feb 3, 2018
  12. Offline

    timtower Administrator Administrator Moderator

  13. Offline

    Arbuzik999

    Oh, forgot for image
    upload_2018-2-2_16-53-53.png
     
  14. Offline

    timtower Administrator Administrator Moderator

    @Arbuzik999 Select the project, hit refresh, export again.
     
  15. Offline

    Arbuzik999

    Doesn't helps..

    Maybe it is code error?

    Code:
    package com.warncommands;
    
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    
    import net.md_5.bungee.api.ChatColor;
    
    public class Commands implements CommandExecutor {
      
    
        @Override
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
          
                if (sender instanceof Player)
                {
                    if (cmd.getName().equalsIgnoreCase("warn"))
                    {
                        Player player = (Player) sender;
                        player.sendMessage(ChatColor.YELLOW + "WarnCommands\n\n" + ChatColor.GREEN + "Author: Arbuzik" + ChatColor.RED + "999\n" + ChatColor.GREEN + "Version: " + ChatColor.YELLOW + "Alpha 1.0" );
                        return true;
                    }
                }
                return false;
        }
    
    }
    
    Main class:

    Code:
    package com.warncommands;
    
    import org.bukkit.event.Listener;
    import org.bukkit.plugin.java.JavaPlugin;
    
    import net.md_5.bungee.api.ChatColor;
    
    public class Main extends JavaPlugin implements Listener {
       
        public Commands commands = new Commands();
       
    
        public void onEnable() {
            getCommand("warn").setExecutor(commands);
            getServer().getConsoleSender().sendMessage(ChatColor.RED + "Warn" + ChatColor.GREEN + "Commands"  + ChatColor.AQUA + " has been successfully enabled!");
        }
       
        public void onDisable() {
            getServer().getConsoleSender().sendMessage(ChatColor.RED + "Warn" + ChatColor.GREEN + "Commands"  + ChatColor.AQUA + " has been successfully " + ChatColor.RED +  "disabled!");
        }
       
    }
    
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Feb 2, 2018
  16. Offline

    timtower Administrator Administrator Moderator

    Did it get rid of the eclipse error?
     
  17. Offline

    Arbuzik999

    yes
     
  18. Offline

    timtower Administrator Administrator Moderator

    Then please post the new errors.
     
  19. Offline

    Arbuzik999

    same.
     
  20. Offline

    timtower Administrator Administrator Moderator

    As what? You posted multiple!
     
  21. What's all the confusion about, just move the plugin.yml to the src folder?

    Also if your problem is solved, please mark the thread as solved!
     
  22. Offline

    Arbuzik999

    Solved!! I renamed Main class to lower case and it works! Thanks everyone who tried to fix my error!
     
  23. That's a bad solution. I think the problem is in your plugin.yml, try switching
    Code:
    main: com.whatever.myplugin.main
    to
    Code:
    main: com.whatever.myplugin.Main
    instead. "main: " points to your Main class, not just your package.
     
  24. Offline

    Arbuzik999

    No, in plugin.yml it was uppercase.
     
Thread Status:
Not open for further replies.

Share This Page