package friend;

import java.io.File;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import cn.nukkit.Player;
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();
	}

	@SuppressWarnings("unchecked")
	public ArrayList<Player> getFriend(String player) {
		ArrayList<Player> friend = new ArrayList<>();

		for (String str : (List<String>) ((Map<String, Object>) this.FriendDB.get(player.toLowerCase())).get("friends")) {
			friend.add(plugin.getServer().getPlayer(str));
		}

		return friend;

	}
}

@@ -757,16 +757,175 @@
 ();%0A%09%7D%0A%0A
+%09@SuppressWarnings(%22unchecked%22)%0A%09public Map%3CString, Object%3E get(String player) %7B%0A%09%09return ((Map%3CString, Object%3E) this.FriendDB.get(player.toLowerCase()));%0A%09%7D%0A%0A
 %09@Suppre
@@ -1089,70 +1089,23 @@
 g%3E) 
-((Map%3CString, Object%3E) this.FriendDB.get(player.toLowerCase())
+this.get(player
 ).ge
@@ -1174,17 +1174,16 @@
 ));%0A%09%09%7D%0A
-%0A
 %09%09return
@@ -1191,14 +1191,15 @@
 friend;%0A
-%0A
 %09%7D%0A
+%09%0A
 %7D%0A

add 'get' Method