Reading periods and YAML keys.

Discussion in 'Plugin Development' started by Wehttam664, Sep 7, 2013.

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

    Wehttam664

    For starters, I'm trying to develop a plugin that is capable of altering its own description file to alter the permissions it uses.

    I have the description file saved as a YamlConfiguration, but I ran into a problem when trying to access the permissions: The permissions tend to have periods (or dots, if you want to call them that) in the keys.
    Meaning:
    Code:
    permissions:
      somepermission.*:
        # There'd be info here.
      somepermission.subpermission:
        # Also info here.
    How would I read/write to this with the periods in the keys?
     
  2. Wehttam664
    I'm not sure about this, but try using somepermission\.subpermission when setting a value in config. If it doesn't work, then to my knowledge, that's not possible. You'll have to save it as a string if you want it to work.
     
  3. Offline

    CubieX

    Problem is, those permissions are YAML keys and not values.
    So I guess this is not possible by using a YamlConfiguration.
    It would be possible by using StreamWriters/Readers though. But altering a YAML file this way is stupid.

    But as far as I know, those permissions in your description file will be registered in the permissions plugin you use.
    So altering those permissions on-the-fly will probably not work as you hope it will.
    Btw: Why do you want to change permissions (or generally your description file) annyway?
    I can't see any meaningful reason to do this.

    If you want to play with yaml files just for learning, better use your plugins config.yml or a custom yaml file.
     
Thread Status:
Not open for further replies.

Share This Page