package friend;

import java.io.File;
import java.util.LinkedHashMap;

import cn.nukkit.plugin.Plugin;
import cn.nukkit.utils.Config;

public class DataBase {

	private Plugin plugin;
	private LinkedHashMap<String, Object> FriendDB;

	public DataBase(Plugin plugin) {
		this.plugin = plugin;
		plugin.getDataFolder().mkdirs();

	}

	public void initDB() {
		FriendDB = (LinkedHashMap<String, Object>) new Config(new File(plugin.getDataFolder(), "Friend.json"),
				Config.JSON).getAll();

	}

	public void save() {
		Config FriendDB = new Config(new File(plugin.getDataFolder(), "Friend.json"), Config.JSON);
		FriendDB.setAll(this.FriendDB);
		FriendDB.save();
	}
}

@@ -52,23 +52,121 @@
 til.
-LinkedHashMap;%0A
+ArrayList;%0Aimport java.util.LinkedHashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Aimport cn.nukkit.Player;
 %0Aimp
@@ -755,11 +755,339 @@
 ve();%0A%09%7D
+%0A%0A%09@SuppressWarnings(%22unchecked%22)%0A%09public ArrayList%3CPlayer%3E getFriend(String player) %7B%0A%09%09ArrayList%3CPlayer%3E friend = new ArrayList%3C%3E();%0A%0A%09%09for (String str : (List%3CString%3E) ((Map%3CString, Object%3E) this.FriendDB.get(player.toLowerCase())).get(%22friends%22)) %7B%0A%09%09%09friend.add(plugin.getServer().getPlayer(str));%0A%09%09%7D%0A%0A%09%09return friend;%0A%0A%09%7D
 %0A%7D%0A

add getFriend() ``` return ArrayList<Player>;// friendList