package pl.asie.endernet.lib;

import java.io.File;
import java.util.HashMap;

public class EnderServerManager {
	private HashMap<String, EnderServer> servers = new HashMap<String, EnderServer>();
	
	public EnderServer get(String name) {
		return servers.get(name);
	}
	
	public String getAddress(String name) {
		EnderServer server = get(name);
		if(server != null) return server.address;
		else return null;
	}
	
	public void loadFromJSON(File file) {
		
	}
	
	public void saveToJSON(File file) {
		
	}
}

@@ -61,20 +61,151 @@
 ava.
-util.HashMap
+lang.reflect.Type;%0Aimport java.util.ArrayList;%0Aimport java.util.HashMap;%0A%0Aimport com.google.gson.Gson;%0Aimport com.google.gson.reflect.TypeToken
 ;%0A%0Ap
@@ -321,16 +321,101 @@
 ver%3E();%0A
+%09private HashMap%3CEnderServer, File%3E saveLocation = new HashMap%3CEnderServer, File%3E();%0A
 %09%0A%09publi
@@ -659,26 +659,370 @@
 ile file) %7B%0A
-
 %09%09
+Gson gson = new Gson();%0A%09%09String data = FileUtils.load(file);%0A%09%09if(data == null) return; // No data%0A%09%09%0A%09%09Type arrayType = new TypeToken%3CArrayList%3CEnderServer%3E%3E()%7B%7D.getType();%0A%09%09ArrayList%3CEnderServer%3E serverList = gson.fromJson(data, arrayType);%0A%09%09for(EnderServer es: serverList) %7B%0A%09%09%09servers.put(es.name, es);%0A%09%09%09saveLocation.put(es, file);%0A%09%09%7D
 %0A%09%7D%0A%09%0A%09publi

add loadFromJSON to EnderServerManager