Use an exception for match join fails
This commit is contained in:
parent
63758f61cb
commit
fcc6925a03
1 changed files with 5 additions and 23 deletions
|
@ -130,11 +130,7 @@ module.exports = class {
|
||||||
osuPacketWriter.MatchJoinSuccess(matchJSON);
|
osuPacketWriter.MatchJoinSuccess(matchJSON);
|
||||||
|
|
||||||
if (full) {
|
if (full) {
|
||||||
// Inform the client that they can't join the match
|
throw "MatchFullException";
|
||||||
osuPacketWriter = new osu.Bancho.Writer;
|
|
||||||
osuPacketWriter.MatchJoinFail();
|
|
||||||
|
|
||||||
return JoiningUser.addActionToQueue(osuPacketWriter.toBuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the user's current match to this match
|
// Set the user's current match to this match
|
||||||
|
@ -155,6 +151,7 @@ module.exports = class {
|
||||||
// A user has joined a match
|
// A user has joined a match
|
||||||
this.updateMatchListing();
|
this.updateMatchListing();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// Inform the client that there was an issue joining the match
|
||||||
const osuPacketWriter = new osu.Bancho.Writer;
|
const osuPacketWriter = new osu.Bancho.Writer;
|
||||||
|
|
||||||
osuPacketWriter.MatchJoinFail();
|
osuPacketWriter.MatchJoinFail();
|
||||||
|
@ -213,25 +210,10 @@ module.exports = class {
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
getMatchInfoForTourneyClient(MatchID) {
|
|
||||||
let match = null;
|
|
||||||
for (let amatch in this.matches) {
|
|
||||||
if (amatch.matchId == MatchID) {
|
|
||||||
match = amatch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (match == null) return null;
|
|
||||||
else return match.createOsuMatchJSON();
|
|
||||||
}
|
|
||||||
|
|
||||||
getMatch(MatchID) {
|
getMatch(MatchID) {
|
||||||
let match = null;
|
for (let match in this.matches) {
|
||||||
for (let amatch in this.matches) {
|
if (match.matchId == MatchID) return match;
|
||||||
if (amatch.matchId == MatchID) {
|
|
||||||
match = amatch;
|
|
||||||
}
|
}
|
||||||
}
|
return null;
|
||||||
if (match == null) return null;
|
|
||||||
else return match;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue