public STBFriendManager(SensibleToolboxPlugin plugin) {
    saveDir = new File(plugin.getDataFolder(), FRIEND_DIR);
    if (!saveDir.exists()) {
      if (!saveDir.mkdir()) {
        LogUtils.warning("can't create directory: " + saveDir);
      }
    }

    load();
  }
 public void load() {
   for (File f : saveDir.listFiles(ymlFilter)) {
     try {
       YamlConfiguration conf = new YamlConfiguration();
       conf.load(f);
       String name = removeExtension(f.getName());
       UUID id1 = UUID.fromString(name);
       for (String k : conf.getStringList("friends")) {
         UUID id2 = UUID.fromString(k);
         addFriend(id1, id2);
       }
     } catch (Exception e) {
       LogUtils.warning("failed to load friend data for " + f + ": " + e.getMessage());
     }
   }
 }
 public void save() {
   for (UUID id : saveNeeded) {
     YamlConfiguration conf = new YamlConfiguration();
     Set<UUID> idSet = getFriends(id);
     List<String> ids = Lists.newArrayListWithCapacity(idSet.size());
     for (UUID uuid : idSet) {
       ids.add(uuid.toString());
     }
     conf.set("friends", ids);
     File f = new File(saveDir, id.toString() + ".yml");
     try {
       conf.save(f);
     } catch (IOException e) {
       LogUtils.warning("failed to save friend data for " + f + ": " + e.getMessage());
     }
   }
   saveNeeded.clear();
 }