Changed updateUserPoints to be settings points instead of adding to existing points and doing it for all points a user has in one go
This commit is contained in:
parent
bd46ce7df7
commit
58d833f870
|
|
@ -56,16 +56,21 @@ public class Queries {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
PreparedStatement preparedStatement = Database.connection.prepareStatement(sql);
|
PreparedStatement preparedStatement = Database.connection.prepareStatement(sql);
|
||||||
preparedStatement.setInt(1, points);
|
preparedStatement.setString(1, uuid.toString());
|
||||||
preparedStatement.setString(2, uuid.toString());
|
pointsMap.forEach((villagerType, points) -> {
|
||||||
preparedStatement.setString(3, villagerType);
|
try {
|
||||||
|
preparedStatement.setString(2, villagerType);
|
||||||
if (preparedStatement.executeUpdate() == 0)
|
preparedStatement.setInt(3, points);
|
||||||
return createUserPointsEntry(uuid, villagerType, points);
|
preparedStatement.setInt(4, points);
|
||||||
|
preparedStatement.addBatch();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Logger.warning("Unable to add % points to %" +
|
||||||
|
" for villager type %", String.valueOf(points), uuid.toString(), villagerType);
|
||||||
|
}
|
||||||
|
});
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Logger.warning("Unable to add % points to %" +
|
|
||||||
" for villager type %", String.valueOf(points), uuid.toString(), villagerType);
|
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
return (true);
|
return (true);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user