2021-02-05 03:18:24 +00:00
|
|
|
const osu = require("osu-packet");
|
|
|
|
|
|
|
|
module.exports = function(CurrentUser, MatchID) {
|
|
|
|
const match = global.MultiplayerManager.getMatch(MatchID);
|
|
|
|
|
|
|
|
if (match != null) {
|
|
|
|
|
|
|
|
match.isTourneyMatch = false;
|
|
|
|
match.tourneyClientUsers = [];
|
|
|
|
|
2021-02-06 01:27:43 +00:00
|
|
|
if (global.StreamsHandler.isUserInStream(match.matchChatStreamName, CurrentUser.uuid))
|
|
|
|
return global.consoleHelper.printBancho(`Did not add user to channel ${match.matchChatStreamName} because they are already in it`);
|
2021-02-05 03:18:24 +00:00
|
|
|
|
|
|
|
const osuPacketWriter = new osu.Bancho.Writer;
|
|
|
|
|
|
|
|
osuPacketWriter.ChannelRevoked("#multiplayer");
|
2021-02-06 01:27:43 +00:00
|
|
|
if (!global.StreamsHandler.isUserInStream(match.matchChatStreamName, CurrentUser.uuid))
|
|
|
|
global.StreamsHandler.removeUserFromStream(match.matchChatStreamName, CurrentUser.uuid);
|
2021-02-05 03:18:24 +00:00
|
|
|
|
|
|
|
CurrentUser.addActionToQueue(osuPacketWriter.toBuffer);
|
|
|
|
} else {
|
|
|
|
// Still provide feedback just in case
|
|
|
|
// TODO: Check if this has any effect, if not then remove this.
|
|
|
|
const osuPacketWriter = new osu.Bancho.Writer;
|
|
|
|
|
|
|
|
osuPacketWriter.ChannelRevoked("#multiplayer");
|
|
|
|
|
|
|
|
CurrentUser.addActionToQueue(osuPacketWriter.toBuffer);
|
|
|
|
}
|
|
|
|
}
|