use of com.solinia.solinia.Models.SoliniaCraft in project solinia3-core by mixxit.
the class JsonCraftRepository method reload.
@Override
public void reload() {
List<SoliniaCraft> file = new ArrayList<SoliniaCraft>();
try {
Gson gson = new Gson();
BufferedReader br = new BufferedReader(new FileReader(filePath));
file = gson.fromJson(br, new TypeToken<List<SoliniaCraft>>() {
}.getType());
} catch (FileNotFoundException e) {
e.printStackTrace();
}
Crafts.clear();
for (SoliniaCraft i : file) {
Crafts.put(i.getId(), i);
}
System.out.println("Reloaded " + Crafts.size() + " Crafts");
}
Aggregations