YAML help

Discussion in 'Plugin Development' started by Nogtail, Dec 29, 2013.

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

    Nogtail

    I ma using YAML to store data for my plugin and need to get a list of "segments" from each "display" but also need to get the display from each segment. I am currently storing the segment and the display in two places which I don't usually like doing as you have to modify both when making a change to one.

    I think I am using YAML too much like SQL but not sure how I could do it so I wouldn't have to loop through all displays to get a segment.

    If you don't understand what I mean (I don't expect you too) please ask :)

    An example yml file:
    Code:
    displays:
        1:
            region:
                world: world
                direction: EAST
                min:
                    x: 10
                    y: 5
                    z: -1
                max:
                    x: 12
                    y: 7
                    z: -1
            segments:
                -118
                -119
                -120
                -121
    segments:
        118:
            display: 1
            uid: 8425900181159279153
        119:
            display: 1
            uid: 8425900181159555153
        120:
            display: 1
            uid: 8425966221159279153
        121:
            display: 1
            uid: 8425900188462279153
     
  2. Nogtail
    Maybe try something along the lines of this?

    Code:
    //assuming this is in the config.yml
     
    if (getConfig().getKeys(false).contains("segments." + getTheSegmentNum + ".display"){
     
  3. Offline

    Nogtail

    It's not reading it that I have a problem with, it's more the fact that I have display under segment and segment under display. I do this so that I don't need to go through all the displays and call getSegments() then loop through all of them, I want to just get a display from a segment but not have display stored twice, this would be simple with SWL but that is out of the question so I was wondering if it is possible with YAML.
     
  4. Nogtail
    I just realized tht what I posted has nothing to do with your problem :p When I get home I'll figure something out. It sucks doing this on a phone :p
     
    Nogtail likes this.
Thread Status:
Not open for further replies.

Share This Page