use of com.solinia.solinia.Models.SoliniaLootDrop in project solinia3-core by mixxit.
the class SoliniaLootFactory method CreateLootDrop.
public static void CreateLootDrop(String lootdropname, boolean operatorCreated) throws CoreStateInitException {
SoliniaLootDrop lootdrop = new SoliniaLootDrop();
lootdrop.setId(StateManager.getInstance().getConfigurationManager().getNextLootDropId());
lootdrop.setName(lootdropname);
lootdrop.setOperatorCreated(operatorCreated);
StateManager.getInstance().getConfigurationManager().addLootDrop(lootdrop);
}
use of com.solinia.solinia.Models.SoliniaLootDrop in project solinia3-core by mixxit.
the class JsonLootDropRepository method commit.
@Override
public void commit() {
// TODO Auto-generated method stub
GsonBuilder gsonbuilder = new GsonBuilder();
// gsonbuilder.setPrettyPrinting();
gsonbuilder.registerTypeAdapterFactory(new ISoliniaLootDropEntryTypeAdapterFactory(SoliniaLootDropEntry.class));
Gson gson = gsonbuilder.create();
String jsonOutput = gson.toJson(lootdrops.values(), new TypeToken<List<SoliniaLootDrop>>() {
}.getType());
try {
File file = new File(filePath);
if (!file.exists())
file.createNewFile();
FileOutputStream fileOut = new FileOutputStream(file);
OutputStreamWriter outWriter = new OutputStreamWriter(fileOut);
outWriter.append(jsonOutput);
outWriter.close();
fileOut.close();
System.out.println("Commited " + lootdrops.size() + " lootdrops");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Aggregations