Skip to content
Snippets Groups Projects
Commit 971b1c24 authored by Schuh Martin's avatar Schuh Martin
Browse files

Update: Persistence.java (added data verification to updatePLayerStatistics() method)

parent 4343b4fb
No related branches found
Tags v0.1.1
5 merge requests!74V1,!73Initial commit,!71Merge DataBase into Development,!27Player can now place bombs that have a explosion radius that dont go through the wall.,!19Update: AccountType.java (moved to package "ENUMs")
......@@ -238,17 +238,23 @@ public class Persistence {
}
public void updatePlayerStatistics(int kills, int deaths, int gameTime, int blocksDestroyed, boolean gameWon) throws DatabaseException{ //after game round
statistics.addKills(kills);
statistics.addDeaths(deaths);
statistics.addGameTime(gameTime);
statistics.addBlocksDestroyed(blocksDestroyed);
if(gameWon){
statistics.addGamesWon();
try {
Parser.playerStatsValid(new PlayerStatistics(0, 0, kills, deaths, blocksDestroyed, gameTime)); //temp instance of PLayerStatistics to validate new values
statistics.addKills(kills);
statistics.addDeaths(deaths);
statistics.addGameTime(gameTime);
statistics.addBlocksDestroyed(blocksDestroyed);
if(gameWon){
statistics.addGamesWon();
}
else{
statistics.addGamesLost();
}
log.info("Statistics successfully updated!");
}
else{
statistics.addGamesLost();
catch(Exception e){
log.error(e);
}
log.info("Statistics successfully updated!");
}
public void createAccount(String playerName, String password, AccountType type) throws DatabaseException {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment