Getting all Strings in a List from Config

Discussion in 'Plugin Development' started by stormneo7, Jan 6, 2014.

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

    stormneo7

    Say that my Config file looked like...
    (name):
    warp:
    (warpname):
    (location):
    (warpname):
    (location):

    Ex.
    stormneo7:
    warp:
    house:
    location: world, 2, 31, 49
    mine:
    location: world, 38, 2, 49

    How would I get the list of all the warps of player stormneo7 and add it onto a StringBuilder? I'm just stuck at the part of how I get the warp names.

    The end result should only return strings "House, Mine".

    Many Thanks.
     
  2. Offline

    MrZoraman

    Code:java
    1. getConfig().getConfigurationSection("stormneo7.warp").getKeys(false);
    should do the trick.

    The boolean at the end decides whether to get all the values from the 'stormneo7.warp' context down, or just at that level. I don't quite remember the results of putting in true, but I remember that it's nothing I ever figured I'd have a use for.

    T3h Cr33p3r
    Ah, thanks. I couldn't remember if it did that, or if I'd get something like thing1, thing1.thing2, thing3, thing4, thing4.thing5.thing6, etc etc. For some reason I felt that it was the latter, but I didn't feel like opening my eclipse to mess around lol

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

    stormneo7

Thread Status:
Not open for further replies.

Share This Page