Solved Config setting a list

Discussion in 'Plugin Development' started by Failplease, Jan 13, 2014.

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

    Failplease

    I have the following method in my code:
    Code:
    public void protect(Set<Location> locations) {
        for(Location l : locations) {
            int x = l.getBlockX();
            int y = l.getBlockY();
            int z = l.getBlockZ();
            World w = l.getWorld();
            List<String> locs = fileapi.getFile().getStringList("protected-locations");
            List<String> locs1 = new ArrayList<String>();
            locs1.add(x + ", " + y + ", " + z + ", " + w.getName());
            locs.addAll(locs);
            fileapi.getFile().set("protected-locations", locs);
            fileapi.saveFile();
        }
    }
    "fileapi" is just my api for creating more yml files.
    When I use this method and the config is empty, I just get the same thing:
    Code:
    protected-locations: []
    Can anyone tell me what I did wrong?
     
  2. Offline

    Mathias Eklund

    You don't access locs1, you only get the predefined in the config and then put it back in. You don't use locs1.
     
  3. Offline

    Failplease

  4. Offline

    Mathias Eklund

    I do those mistakes sometimes aswell, xd. I HATE IT
     
Thread Status:
Not open for further replies.

Share This Page