Solved plugin.yml error

Discussion in 'Plugin Development' started by Jazzandmax, Nov 16, 2013.

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

    Jazzandmax

    Hi, i'm a new plugin maker and I got this error upon loading the server with my custom plugin installed

    Code:
    [SEVERE] Could not load 'plugins\WCPCustom.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
        at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:255)
        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.util.zip.ZipException: error in opening zip file
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(Unknown Source)
        at java.util.zip.ZipFile.<init>(Unknown Source)
        at java.util.jar.JarFile.<init>(Unknown Source)
        at java.util.jar.JarFile.<init>(Unknown Source)
        at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:243)
        ... 8 more
    Can someone help me?
     
  2. Offline

    GusGold

    Jazzandmax
    Care to show your plugin.yml file?

    Jazzandmax
    Also why is it giving a zip error? There shouldn't be a zip that it is loading for the plugin.yml

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  3. Offline

    Jazzandmax

    Here is the plugin.yml:

    Code:
    name: WCPCustom
    main: com.gmail.<name>.WCP
    version: 1.0
    description: WorldCraftPlaying's Custom Plugin By Jazzandmax
    commands:
      WCPHello:
      description: Say Hi to the server!
      usage: Oops, try /WCPHello
      permission: WCP.Hello
      permission-message: It seems that you don't have access to this command! (WCP.Hello)
      WCPGoodbye:
      description: Leave the server with a good mood!
      usage: Oops, try /WCPGoodbye
      permission: WCP.Goodbye
      permission-message: It seems that you don't have access to this command! (WCP.Goodbye)
    And the code for the plugin:
    Code:java
    1. package com.gmail.<name>;
    2.  
    3. import org.bukkit.command.Command;
    4. import org.bukkit.command.CommandSender;
    5. import org.bukkit.entity.Entity;
    6. import org.bukkit.entity.Player;
    7. import org.bukkit.entity.TNTPrimed;
    8. import org.bukkit.event.EventHandler;
    9. import org.bukkit.event.entity.ExplosionPrimeEvent;
    10.  
    11. public class WCP {
    12.  
    13. public boolean onCommand11(CommandSender sender, Command cmd, String label, String[] args){
    14. if(cmd.getName().equalsIgnoreCase("WCPHello")){ //
    15. return true;
    16. if (!(sender instanceof Player)) {
    17. sender.sendMessage("[WCP] Hello fellow World Craft Playing Player!");
    18. }
    19. return false; }
    20. }
    21. public boolean onCommand1(CommandSender sender, Command cmd, String label, String[] args){
    22. if(cmd.getName().equalsIgnoreCase("WCPGoodBye")){ /
    23. // doSomething
    24. return true;
    25. if (!(sender instanceof Player)) {
    26. sender.sendMessage("[WCP] Goodbye, I hope you had a nice time here!");
    27.  
    28.  
    29. }
    30. return false; }
    31. }
    32.  
    33.  
    34.  
    35.  

    <name> = my email name

    And please tell me if I messed something up with my code, because i'm new at this.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  4. Offline

    jboy44

    Your indentation is incorrect.
    For your plugin.yml, try something like this instead:
    Code:
    name: WCPCustom
    main: com.gmail.<name>.WCP
    version: 1.0
    author: Jazzandmax
    description: WorldCraftPlaying's Custom Plugin!
    commands:
        WCPHello:
            description: Say Hi to the server!
            usage: Oops, try /WCPHello
        WCPGoodbye:
            description: Leave the server with a good mood!
            usage: Oops, try /WCPGoodbye
    permissions:
        WCP.Hello:
            permission-message: It seems that you don't have access to this command! (WCP.Hello)[/FONT]
            description: WCPHello permission!
            default: op
        WCP.Goodbye:
            permission-message: It seems that you don't have access to this command! (WCP.Goodbye)[/FONT]
            description: WCPGoodbye permission!
            default: op
    If you need any extra help with yml files, try this.
     
  5. Offline

    michaelkrauty

    You're not indenting properly
    Code:
    commands:
      WCPHello:
      description: Say Hi to the server!
      usage: Oops, try /WCPHello
      permission: WCP.Hello
      permission-message: It seems that you don't have access to this command!
    should be
    Code:
    commands:
      WCPHello:
        description: Say Hi to the server!
        usage: Oops, try /WCPHello
        permission: WCP.Hello
        permission-message: It seems that you don't have access to this command!
     
  6. Offline

    wizard7611

    yea, was about to say your indenting was wrong. Don't worry though, it happens a lot. XD
     
  7. Offline

    Jazzandmax

    Thanks, i'll try this. As I am new at this. :)

    jboy44 I changed my plugin.yml to what you said and I got this:

    Code:
    [SEVERE] Could not load 'plugins\WCP.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
        at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:255)
        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.util.zip.ZipException: error in opening zip file
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(Unknown Source)
        at java.util.zip.ZipFile.<init>(Unknown Source)
        at java.util.jar.JarFile.<init>(Unknown Source)
        at java.util.jar.JarFile.<init>(Unknown Source)
        at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:243)
        ... 8 more
    My plugin.yml:

    Code:
    name: WCPCustom
    main: com.gmail.<NAME>.WCP
    version: 1.0
    author: Jazzandmax
    description: WorldCraftPlaying's Custom Plugin!
    commands:
        WCPHello:
            description: Say Hi to the server!
            usage: Oops, try /WCPHello
        WCPGoodbye:
            description: Leave the server with a good mood!
            usage: Oops, try /WCPGoodbye
    permissions:
        WCP.Hello:
            permission-message: It seems that you don't have access to this command! (WCP.Hello)[/FONT]
            description: WCPHello permission!
            default: op
        WCP.Goodbye:
            permission-message: It seems that you don't have access to this command! (WCP.Goodbye)[/FONT]
            description: WCPGoodbye permission!
            default: op
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  8. Offline

    AoH_Ruthless

    Jazzandmax
    Why are you exporting a zip file .... ?
    As the stack trace says, that's what is causing the error. Export your plugin as a .jar file.
     
    jboy44 likes this.
  9. Offline

    Jazzandmax

    [​IMG]It is a .jar file...
     
  10. Offline

    AoH_Ruthless

    Jazzandmax
    Can you paste the Eclipse Screen when you are exporting the plugin?
    And "tahg" me or else I will not see your post.
     
  11. Offline

    Jazzandmax

    AoH_Ruthless
    I export it in parts then I put the parts into a .jar with 7zip

    Eclipse screen:
    [​IMG]
     
  12. Offline

    L33m4n123

    why not exporting it directly as a .jar file? In my experience 7Zip and Jar files do not work well together. I use winRar for jar files
     
  13. Offline

    agokhale1

    Jazzandmax
    Can I see your project directory (i can't see a plugin.yml)? Also save it to C:\Users\jassmax\Desktop\WCP.jar\
     
  14. Offline

    AoH_Ruthless

    Jazzandmax
    In that screenshot I don't see plugin.yml anywhere ...
     
  15. Offline

    Jazzandmax

    I
    I also added the plugin.yml when I make the .jar with 7zip

    And ill try exporting it like C:\Users\jassmax\Desktop\WCP.jar\

    It only makes a folder called "WCP"

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  16. Offline

    agokhale1

    You should not make the jar with 7ZIP, export it directly as a jar file from eclipse with all of the files in the jar already compiled.
     
    L33m4n123 likes this.
  17. Offline

    Jazzandmax

    agokhale1
    I did as you said and I got this on my desktop...
    [​IMG]
     
  18. Offline

    L33m4n123

    Did you exported it directly into a jar file or did it again with 7zip? If you did it again with 7zip then you got your error there. 7zip does not work with jar files the way you want it to work
     
  19. Offline

    Jazzandmax

    L33m4n123

    Here:
    I'm so glad I have you guys to help me
    [​IMG]
     
  20. Offline

    AoH_Ruthless

    Jazzandmax
    I don't know if you still have an error, but I would delete the folder WCP.jar, because it's only being overriden each time. Be sure that it not making a compressed file.
     
  21. Offline

    Jazzandmax

    I fixed the .jar bug but now that I fixed it I get this:

    Code:
    [SEVERE] Could not load 'plugins\WCP.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: commands are of wrong type
        at org.bukkit.plugin.PluginDescriptionFile.loadMap(PluginDescriptionFile.java:849)
        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.ClassCastException: java.lang.String cannot be cast to java.util.Map
        at org.bukkit.plugin.PluginDescriptionFile.loadMap(PluginDescriptionFile.java:831)
        ... 10 more
     
  22. Offline

    AoH_Ruthless

    Jazzandmax
    How are you exporting it? You should be exporting as a runnable .jar file.
     
  23. Offline

    L33m4n123


    No need to. He can do it as 'normal' Jar File aswell

    and read the stacktrace it says

    so he has an issue within his code
     
  24. Offline

    Jazzandmax

    it is not letting me export it as a runnable .jar
    [​IMG]
     
  25. Offline

    L33m4n123

    As I said. the error is in your actual code now
     
  26. Offline

    Jazzandmax

    L33m4n123
    Sorry Here is the bug I think
    [​IMG]
    Here is a bigger view of the code:
    =[​IMG]

    Oh and this is a different code I was starting to see if I did something wrong which I think I did

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  27. Offline

    L33m4n123

    Mind copying the code here in a code-tag so I can look at all of it since it looks like a bracket error or check all the brackets yourself again
     
  28. Offline

    Jazzandmax

    Code:java
    1. package com.gmail.maxwellall2003;
    2.  
    3. import org.bukkit.Color;
    4. import org.bukkit.command.Command;
    5. import org.bukkit.command.CommandSender;
    6. import org.bukkit.entity.Entity;
    7. import org.bukkit.entity.Player;
    8. import org.bukkit.entity.TNTPrimed;
    9. import org.bukkit.event.EventHandler;
    10. import org.bukkit.event.entity.ExplosionPrimeEvent;
    11.  
    12. public class WCP {
    13.  
    14. public boolean onCommand11(CommandSender sender, Command cmd, String label, String[] args){
    15. if(cmd.getName().equalsIgnoreCase("WG")){ // If the player typed /basic then do the following...
    16. // doSomething
    17. return true;
    18. if (!(sender instanceof Player)) {
    19. sender.sendMessage(Color.RED + "Warrior Gaming");
    20. sender.sendMessage(Color.YELLOW + "------- HELP MENU -------");
    21. sender.sendMessage(Color.AQUA + "/WGNews: Lists all the news and updates!");
    22. sender.sendMessage("");
    23. } //If this has happened the function will return true.
    24. // If this hasn't happened the a value of false will be returned.
    25. return false; }
    26. }
    27. public boolean onCommand1(CommandSender sender, Command cmd, String label, String[] args){
    28. if(cmd.getName().equalsIgnoreCase("WCPGoodBye")){ // If the player typed /basic then do the following...
    29. // doSomething
    30. return true;
    31. if (!(sender instanceof Player)) {
    32. sender.sendMessage("[WCP] Goodbye, I hope you had a nice time here!");
    33.  
    34.  
    35. } //If this has happened the function will return true.
    36. // If this hasn't happened the a value of false will be returned.
    37. return false; }
    38.  
    39.  
    40.  
    41. }
    42.  
    43.  
    44.  
    45.  
    46.  
     
  29. Offline

    L33m4n123

    If it is your only class it HAS to extend JavaPlugin

    and you are missing a closing bracket at the end
     
  30. Offline

    Jazzandmax

    Isn't 41 the closing bracket?
     
Thread Status:
Not open for further replies.

Share This Page