Delete row when a player loses their win streak
This commit is contained in:
parent
43867a7018
commit
0b7e5d15e0
@ -74,7 +74,7 @@ public class WinStreakManager extends MiniDbClientPlugin<Map<Integer, Integer>>
|
||||
|
||||
if (map.containsKey(game.getGameId()))
|
||||
{
|
||||
runAsync(() -> _repository.setWinStreak(ClientManager.getAccountId(player), game.getGameId(), 0));
|
||||
runAsync(() -> _repository.removeWinStreak(ClientManager.getAccountId(player), game.getGameId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ class WinStreakRepository extends RepositoryBase
|
||||
{
|
||||
|
||||
private static final String UPDATE_OR_INSERT = "REPLACE INTO accountWinStreak VALUES(?,?,?)";
|
||||
private static final String DELETE = "DELETE FROM accountWinStreak WHERE accountId=? AND gameId=?";
|
||||
|
||||
WinStreakRepository()
|
||||
{
|
||||
@ -22,4 +23,12 @@ class WinStreakRepository extends RepositoryBase
|
||||
new ColumnInt("value", value)
|
||||
);
|
||||
}
|
||||
|
||||
void removeWinStreak(int accountId, int gameId)
|
||||
{
|
||||
executeUpdate(DELETE,
|
||||
new ColumnInt("accountId", accountId),
|
||||
new ColumnInt("gameId", gameId)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user