From b6a0d5e4b1b05f48bc7374da176ed2b08185aa58 Mon Sep 17 00:00:00 2001 From: Holly Date: Sun, 27 Nov 2022 23:48:43 +0000 Subject: [PATCH] make match finish async again --- server/objects/Match.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server/objects/Match.ts b/server/objects/Match.ts index f72eafa..5df220a 100644 --- a/server/objects/Match.ts +++ b/server/objects/Match.ts @@ -550,10 +550,12 @@ export class Match { } // All players have finished playing, finish the match - if (allLoaded) await this.finishMatch(); + if (allLoaded) { + await this.finishMatch(); + } } - public finishMatch() { + public async finishMatch() { if (!this.inProgress) { return; } @@ -597,6 +599,8 @@ export class Match { slot.status = SlotStatus.NotReady; } + await this.sharedContent.database.query("INSERT INTO mp_match_rounds (id, match_id, round_id, round_mode, match_type, round_scoring_type, round_team_type, round_mods, beatmap_md5, freemod, player0, player1, player2, player3, player4, player5, player6, player7, player8, player9, player10, player11, player12, player13, player14, player15) VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", queryData); + osuPacketWriter.MatchComplete(); // Inform all users in the match that it is complete @@ -609,8 +613,6 @@ export class Match { // TODO: Re-implement multiplayer extras //if (this.multiplayerExtras != null) this.multiplayerExtras.onMatchFinished(JSON.parse(JSON.stringify(this.playerScores))); - this.sharedContent.database.query("INSERT INTO mp_match_rounds (id, match_id, round_id, round_mode, match_type, round_scoring_type, round_team_type, round_mods, beatmap_md5, freemod, player0, player1, player2, player3, player4, player5, player6, player7, player8, player9, player10, player11, player12, player13, player14, player15) VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", queryData); - this.playerScores = undefined; }