public void updateWorlds() {
   for (Iterator<Map.Entry<String, List<NamedLocation>>> i = unloadedLocs.entrySet().iterator();
       i.hasNext(); ) {
     Map.Entry<String, List<NamedLocation>> entry = i.next();
     World world = CommandBook.server().getWorld(entry.getKey());
     if (world == null) continue;
     i.remove();
     for (NamedLocation warp : entry.getValue()) {
       warp.getLocation().setWorld(world);
       locs.put(warp.getName().toLowerCase(), warp);
     }
   }
   for (Iterator<NamedLocation> i = locs.values().iterator(); i.hasNext(); ) {
     NamedLocation loc = i.next();
     if (CommandBook.server().getWorld(loc.getWorldName()) == null) {
       i.remove();
       getNestedList(unloadedLocs, loc.getWorldName()).add(loc);
     }
   }
 }
  public void save() throws IOException {
    FileOutputStream output = null;

    try {
      output = new FileOutputStream(file);
      OutputStreamWriter streamWriter = new OutputStreamWriter(output, "utf-8");
      BufferedWriter writer = new BufferedWriter(streamWriter);

      CSVWriter csv = new CSVWriter(writer);

      synchronized (this) {
        for (Map.Entry<String, NamedLocation> entry : locs.entrySet()) {
          NamedLocation warp = entry.getValue();

          csv.writeNext(
              new String[] {
                warp.getName(),
                warp.getWorldName() != null
                    ? warp.getWorldName()
                    : warp.getLocation().getWorld().getName(),
                warp.getCreatorName(),
                String.valueOf(warp.getLocation().getX()),
                String.valueOf(warp.getLocation().getY()),
                String.valueOf(warp.getLocation().getZ()),
                String.valueOf(warp.getLocation().getPitch()),
                String.valueOf(warp.getLocation().getYaw()),
              });
        }
      }

      csv.flush();
      csv.close();
    } finally {
      if (output != null) {
        try {
          output.close();
        } catch (IOException e) {
        }
      }
    }
  }