Skip to content

Commit

Permalink
fix(attribute): prevent infinite rewards from disconnecting in middle…
Browse files Browse the repository at this point in the history
… of battle tower attempt
  • Loading branch information
danorris709 committed Apr 19, 2023
1 parent 5ce7871 commit e12ff08
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ private BattleRules createRules() {
}

public void finishAttempt() {
if (this.attemptStart == -1) {
return;
}

this.heldItem.clear();
long duration = System.currentTimeMillis() - this.attemptStart;

Expand Down Expand Up @@ -352,6 +356,8 @@ public void load() {

@Override
public void save() {
this.finishAttempt();

try (Connection connection = this.manager.getDatabase().getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(BattleTowerQueries.UPDATE_USERNAME)) {
preparedStatement.setString(1, this.parent.getName());
Expand Down

0 comments on commit e12ff08

Please sign in to comment.