Solved Config.yml InvalidConfigurationException: Top Layer is Not a Map

Discussion in 'Plugin Development' started by nuclearmissile, Jan 8, 2014.

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

    nuclearmissile

    My latest plugin being nearly done, I added the config file and code to handle it, but I get this exception when trying to load the plugin on my server. Here is the config.yml file:

    #Omega Treasure Default Config
    CRYSTALCUTTER:true
    BLACKSTEELBLADE:true
    TOXICSPINE:true
    VULCANEDGE:true
    TARTRATHIANHORROR:true
    REAPERSICKLE:true
    ETHEREALHAMMER:true
    VOIDSBANE:true
    WITHERSRETRIBUTION:true
    BLOODRIPPER:true
    SCREAMINGHATE:true
    ENDLESSDARK:true
    SUNSFURY:true
    CRELMITELONGBOW:true
    TARTRATHIANSCEPTRE:true
    VULCANFIRE:true
    EMPERORGREATSWORD:true
    ZEUSBOLTSLINGER:true
    RITEOFDELIVERANCE:true
    VITALSTONE:true
    BERSERKERSRAGE:true
    GUARDIANSTONE:true
    ANCIENTBATTLESIGN:true
    VULCANWAND:true
    LESSERLOOT:true

    Is there something I'm missing here? Did I incorrectly format it? As far as I can tell, I followed TheBCBroz's tutorial to the letter. Any help is greatly appreciated! :)
     
  2. Offline

    Sagacious_Zed Bukkit Docs

    nuclearmissile As the error indicated, your plugin.yml is invalid. It would seem the parser has determined that the top layer is not a map, and hence does not have the proper expected format. For the expected format please see http://wiki.bukkit.org/Plugin_Tutorial
     
  3. Offline

    nuclearmissile

    Sagacious_Zed First of all, it's definitely my config.yml that is giving the error, and secondly, the config reference api is a mess of confusion, which is why I preferred to use a video tutorial that showed an example of a practical application. This is a very specific error and I was hoping to find somebody who'd encountered it and could help me fix whatever the plugin doesn't like.
     
  4. Offline

    Sagacious_Zed Bukkit Docs

    It is a formatting error. Since the forum destroys formatting when not marked as code, you should make sure that your config.yml is indeed properly formatted yaml. As it stands right now, it is not.
     
  5. Offline

    nuclearmissile

    Ok I'll put it in here formatted as code:

    Code:
    # Omega Treasure Default Config
    CRYSTALCUTTER:true
    BLACKSTEELBLADE:true
    TOXICSPINE:true
    VULCANEDGE:true
    TARTRATHIANHORROR:true
    REAPERSICKLE:true
    ETHEREALHAMMER:true
    VOIDSBANE:true
    WITHERSRETRIBUTION:true
    BLOODRIPPER:true
    SCREAMINGHATE:true
    ENDLESSDARK:true
    SUNSFURY:true
    CRELMITELONGBOW:true
    TARTRATHIANSCEPTRE:true
    VULCANFIRE:true
    EMPERORGREATSWORD:true
    ZEUSBOLTSLINGER:true
    RITEOFDELIVERANCE:true
    VITALSTONE:true
    BERSERKERSRAGE:true
    GUARDIANSTONE:true
    ANCIENTBATTLESIGN:true
    VULCANWAND:true
    LESSERLOOT:true
    Ok, now what?
     
  6. Offline

    Sagacious_Zed Bukkit Docs

    nuclearmissile
    As it stands, it is not a valid yaml file for use as config.yml
     
  7. Offline

    nuclearmissile

    Sagacious_Zed You're not telling me why. If I could reasonably learn why from other threads, I wouldn't be asking on here.
     
  8. Offline

    Sagacious_Zed Bukkit Docs

    It is invalid because, as the exception notes, the level is not a map. The top level must be a map.
     
  9. Offline

    nuclearmissile

    The top level must be a map? Now you mean a hashmap? That doesn't make sense to me because TheBCBroz tutorial just said to use # for comments and then the list of variables and their values separated by colons. Any idea how I would fix it?
     
  10. Offline

    Sagacious_Zed Bukkit Docs

    No, A HashMap is a Java implementation of the Java Map Interface.

    Config.yml is a yaml file and thus must conform to the yaml specification. See http://yaml.org/spec/1.1/
    Specifically http://yaml.org/spec/1.1/#id932806
     
  11. Offline

    nuclearmissile

    Sagacious_Zed Ok, I'll look into that, but I still get the feeling that the problem with my config is really obvious to you and you're not telling me. ;)
     
  12. Offline

    Sagacious_Zed Bukkit Docs

    It is really obvious. It is not a map...

    Show Spoiler
    The fix is to turn what you have into a valid yaml map
     
  13. Offline

    nuclearmissile

    Sagacious_Zed Ok? I'm sorry for sounding a bit frustrated, but that's what you've been telling me, but no matter how hard I read that section of the YAML website I cannot figure out what's wrong. Do I need to put spaces between the colons and the bool values? I'll go try that now.

    Sagacious_Zed It works now. And here is where I sound like an asshole. Why the hell couldn't you just tell me that I was missing spaces? What value is there other than "Oh look at me I'm sagacious_zed and everybody who's ever helped me just told me to go read the documentation so I'm going to pass that stupidity on to anyone who asks for help." ? I mean really, you're wasting your own time and just telling me what was wrong wouldn't negatively affect my ability to learn in any way whatsoever. Why? Is it out of spite?

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

    Sagacious_Zed Bukkit Docs

    nuclearmissile Encountering an Error and then discovering what you did (or forgot to do, in this case) IS part of the learning experiance.

    For example, had I not go in this roundabout way to lead you to the answer, you would not have had as strong of a notion between the difference of a HashMap and Maps as they are listen in YAMl.
     
  15. Offline

    nuclearmissile

    Sagacious_Zed I understand that you don't like telling people exactly what to do, but this was such a small, silly mistake, and it really didn't make it clear in the documentation that you had to have a space after the colon. If I were asking somebody to write an entire plugin, I'd understand wanting me to learn it myself, but this was less of a learning experience and more of an exercise in futility at understanding the convoluted docs. I still know what HashMaps are, and I still don't really know what YAML maps are, and that's fine cause for the sake of these plugins I don't have to comprehend that file type, I just need to know the syntax. Idk, I'm sorry I was getting frustrated, but really I think if you're going to post on a help forum you should try to teach. At least that's what I try to do when I find a question on here I know how to answer. Thanks for trying to help me anyway! :)
     
Thread Status:
Not open for further replies.

Share This Page