Solved Config: Get each value and add player with his value to ArrayList

Discussion in 'Spigot Plugin Development' started by RAIX, Oct 12, 2019.

Thread Status:
Not open for further replies.
  1. Hello,

    so I have a config like this:

    Code (YAML):
    3769e63a-1009-4b10-33da-27123dab8c3: red
    40320403-1219-2a10-11da-27132d8b8c3
    : red
    234329a3-1439-7f10-77da-29994d8b863
    : blue
    3769e63a-1009-4b10-33da-27123dab8c3
    : blue
    40320403-1219-2a10-11da-27132d8b8c3
    : red
    234329a3-1439-7f10-77da-29994d8b863
    : blue
     
    So the format is
    uuid: string

    I also have 2 ArrayLists.
    How would I go through this list and add everyone who has the value "red" to the ArrayList<Player> teamRed and those who have the value to the blue team?


    Thanks ! :)
     
  2. Hello,

    Just iterate over all the keys with getConfig().getKeys(false);, get the value and check if it is equals to "red", if so, add the key to a list.
     
    • Informative Informative x 1
  3. Hello,
    thanks for your answer. :)
    Didn't think that it was that easy!
     
Thread Status:
Not open for further replies.