Find Path of String in Configuration

Discussion in 'Plugin Development' started by WiseHollow, Feb 6, 2013.

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

    WiseHollow

    I'm trying to search my configuration yml file for the path of a string. My config file looks like the following...

    Code:
    Realms:
      Scavengers:
        master: machu05
        location: ''
        members:
        - machu05
        - WiseHollow
    
    An example of what I am trying to accomplish is: assigning the path of the member WiseHollow to a string called "path". Anyone know how to do this?
     
  2. Offline

    Sagacious_Zed Bukkit Docs

    WiseHollow can never have a path as it is an element of a list.
     
  3. Offline

    WiseHollow

    So there is no way to find out where WiseHollow is if there were multiple objects like "Scavengers"?
     
  4. Offline

    triarry

    I'm also interested in this, I'm working on a blacklist item plugin and I'd like server owners to display the items they want to blacklist in a list similar to this.
     
  5. Offline

    RealDope

    Something like this, don't have an IDE open, not tested
    Code:JAVA
    1.  
    2. public String getPath(String value) {
    3. for(String s : getConfig().getKeys(true)) {
    4. String s = getConfig().getString(s);
    5. if(s.equals(value) {
    6. return s;
    7. }
    8. }
    9. }
    10.  


    Also, not putting tons of effort into this, so this assumes that all your config options are strings, which obviously they aren't but I'm just giving you a vague idea.
     
  6. Offline

    Royal_Soda

    Check this page out.
     
Thread Status:
Not open for further replies.

Share This Page