Solved add all players from different lists to 1 list

Discussion in 'Plugin Development' started by HenkDeKipGaming, Jun 22, 2015.

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

    HenkDeKipGaming

    hey, i got something that might sound really hard, but it probably isn't :)
    so, i got different lists in my config. for eample, i got:
    groups.kingdom.vystara
    and
    groups.kingdom.vidal
    now, if a player runs a command, for example /addToList
    i then want all the players from all those groups to be (ALSO!!) added to the list of for example:
    addToList.test
    how do i do this? i only need the part where you add the players from those lists to that 1 list. i got the rest.

    thanks!
     
  2. Offline

    SuperOriginal

  3. Offline

    HenkDeKipGaming

  4. Offline

    SuperOriginal

    Well, it's not Bukkit, it's Java, which you should know already.

    addAll() is a method in the List class, which makes it easy to combine collections(lists..).
    You can simply do:
    Code:
    bigList.addAll(smallList);
    bigList.addAll(smallerList);
    And it adds them all into the list.
     
  5. Offline

    HenkDeKipGaming

    hey, why does this not work?
    Code:
    getConfig().getList("groups.kingdom.vystara").addAll(getConfig().getList("saturday"));
    
     
  6. Offline

    JaydenKieran

    Because the information that @SuperOriginal gave you is for a List class. If you're using configurations, you really should already know about Bukkit's Configuration API, and more specifically how to set values.
     
  7. Offline

    xTrollxDudex

    Because you need to save or set the data back to the config.
     
  8. Offline

    HenkDeKipGaming

    I allready made a kinda group manager that will save lists of people to a config file. I know how saving to a config file works. I am indeed new to coding, now that's said! Please don't tell me that again anyone. I just need help with my problem please.

    can you give an example?

    hey, i tried everything... it just doesn't work!
    i just want multiple lists to add all their content to 1 list on a command...
    is this even possible?

    SOLVED - i don't need this anymore.
    thanks for your reply's!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 12, 2016
Thread Status:
Not open for further replies.

Share This Page