/**
* Load a team from a file and return the ModData used by the team.
*/
public static ModData loadTeam(File f, Pokemon[] team) {
ModData modData = null;
try {
FileInputStream file = new FileInputStream(f);
ObjectInputStream obj = new ObjectInputStream(file);
// First thing in file is a UUID identifying the server.
String uuid = (String) obj.readObject();
modData = ModData.getModData(uuid);
if (modData == null) {
modData = ModData.getDefaultData();
}
Pokemon[] pokemon = null;
synchronized (PokemonSpecies.class) {
PokemonSpeciesData data = PokemonSpecies.getDefaultData();
PokemonSpecies.setDefaultData(modData.getSpeciesData());
try {
pokemon = (Pokemon[]) obj.readObject();
} finally {
PokemonSpecies.setDefaultData(data);
}