[Solved] Keys With Periods in Config.yml

Discussion in 'Plugin Development' started by Lex Talionis, Nov 15, 2011.

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

    Lex Talionis

    Is there a simple method for creating a key in the config.yml that has a period in it? For example, with a plugin that has to do with permission nodes you would want:
    Code:
    groups:
      users:
        permissions:
          permission.example: true;
          permission.creeper.thingum: false;
    Unfortunately thus-far the system tends to read the periods as new subsections no matter what workaround I try. I also tried stacking sections in HashMaps with the deepest Map containing the key/value pair. I've seen this done with the old configuration system, but either it no longer works or I'm just plain doing it wrong.
     
  2. Offline

    HappyPikachu

    I don't think this is possible, or at least not with ease. What's to benefit from using a period? I'd personally use a hyphen for this situation, but that's just me~

    I'll do some searching though (interesting topic thar) and let you know if I find anything.
     
  3. Offline

    Kaikz

    Try escaping the period?
     
  4. Offline

    desht

    Trying to shoehorn periods into config keys is likely to be an exercise in frustration. How about inverting the problem, and making a config file like this:

    Code:
    groups:
      users:
        granted-permissions:
          - permission.example
          - etc.
        denied-permissions:
          - permission.creeper.thingum
          - etc.
    
    There's no problem with having a period in config values.

    (BTW, not sure if the semicolons in your original example are intended or not, but they're not required)
     
  5. Offline

    Lex Talionis

    Actually, I'm not sure. I'm still learning and all the other permissions plugins I've seen use the format I posted up there, but they also all use the deprecated Configuration, which I'm trying to stay away from. I'd rather learn how to use the new stuff properly and not have to relearn later if the old Configuration gets removed.
    Unfortunately \. doesn't work, nor does \\. I tried both. ^_^
    Now this I like. It actually seems cleaner to me. Thanks much!
    Another thing I've learned then. :3 When saving a config, it always generates the colons so I assumed they were necessary.
    EDIT - Ooooh. The semicolons. Yeah, those were typos, I didn't even know they were there.
     
Thread Status:
Not open for further replies.

Share This Page