saving config as a list

Discussion in 'Spigot Plugin Development' started by Buby, May 13, 2016.

  1. Hey guys! I am making a plugin that includes world listing,
    I am using
    Code (Text):

    Bukkit.getServer().getWorlds().stream().map(World::getName).collect(Collectors.joining(", "));
     
    to list the worlds, but I am wondering how do I add a list to config for example
    Code (Text):

    BlacklistedWorlds
    -eg1
    -eg2
    -eg3
     
    I already have the concept of how to blacklist
    Code (Text):

    String worlds = Bukkit.getServer().getWorlds().stream().map(World::getName).collect(Collectors.joining(", "));
                worlds= worlds.replace(" " + blacklistedworld+ ",", "");
     
    how would I beable to save the config as a list and add/remove from the list. and how would I find how much blacklisted worlds there is so I can make a for loop to replace the worlds in the string
     
  2. There is #getStringList and #setStringList iirc. It takes a List<String>
     
  3. looked on docs couldn't find setStringList or anything similar.
     
  4. MiniDigger

    Supporter

  5. MiniDigger

    Supporter

    just use the set method to set stuff.