How to get the beginning of a Path; YML File

Discussion in 'Plugin Development' started by L33m4n123, Apr 11, 2013.

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

    L33m4n123

    Hey guys,

    I am creating a seperate .yml file next to the config.yml.

    It works to read out the String from that specific path. Is it possible however to read out the Path of a certain String or even just the first bit of the Path?

    Now I am going to explain a bit more what exactly I am trying to achieve in the matter that it should be still be unclear (or there might be a more easyer way)

    In a yml file the user of my Plugin should be able to configure his own Race with his own Skills. Now to check before the skills are triggered I basicly need to be able to get the racename and then compare it with the race the actual player has. So I was thinking about setting the yml file up as follows

    Code:
    Human:
      Skills:
        - Skill1
        - Skill2
    And then when the event is triggered I want to get the 'Human' to compare that then with the Player.

    Thanks in advance
     
  2. Offline

    Reteckz

    Keep checking in a while loop with config.contains, and if you get the right result, use config.getCurrentPath()
     
  3. Offline

    L33m4n123

    Ok will test that, thanks

    The only issue is

    config.contains()

    checks if a certain Path is available in the Config File. Not if there is a certain String in it

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

    L33m4n123

    Anyone has any ideas? Otherwise I need to see how to format the races.ymls
     
  5. yml.getKeys() or yml.getValues(), and I suggest deep as false.
     
Thread Status:
Not open for further replies.

Share This Page