Fix for Olympiad points not count after noble status.

Contributed by ArKiroN.
This commit is contained in:
MobiusDevelopment 2019-10-18 10:04:24 +00:00
parent 2bf33d5227
commit 18bada1128

View File

@ -1125,14 +1125,18 @@ public class Olympiad
*/ */
protected synchronized void saveNobleData() protected synchronized void saveNobleData()
{ {
Connection con = null;
if ((_nobles == null) || _nobles.isEmpty()) if ((_nobles == null) || _nobles.isEmpty())
{ {
return; return;
} }
PreparedStatement statement = null; try
try (Connection con = DatabaseFactory.getConnection())
{ {
con = DatabaseFactory.getConnection();
PreparedStatement statement;
for (Integer nobleId : _nobles.keySet()) for (Integer nobleId : _nobles.keySet())
{ {
final StatsSet nobleInfo = _nobles.get(nobleId); final StatsSet nobleInfo = _nobles.get(nobleId);
@ -1163,9 +1167,10 @@ public class Olympiad
statement.setInt(6, compWon); statement.setInt(6, compWon);
statement.setInt(7, compLost); statement.setInt(7, compLost);
statement.setInt(8, compDrawn); statement.setInt(8, compDrawn);
statement.execute();
statement.close();
nobleInfo.set("to_save", false); nobleInfo.set("to_save", false);
updateNobleStats(nobleId, nobleInfo); updateNobleStats(nobleId, nobleInfo);
} }
else else
@ -1177,9 +1182,9 @@ public class Olympiad
statement.setInt(4, compLost); statement.setInt(4, compLost);
statement.setInt(5, compDrawn); statement.setInt(5, compDrawn);
statement.setInt(6, charId); statement.setInt(6, charId);
statement.execute();
statement.close();
} }
statement.execute();
statement.close();
} }
} }
catch (SQLException e) catch (SQLException e)