@@ -23,6 +23,7 @@ const Teams = require("./Enums/BanchoLobbyTeams");
* @prop {Array<BanchoMod>} mods
* @prop {boolean} freemod
* @prop {boolean} playing Whether we're currently playing or not
* @prop {Array<BanchoLobbyPlayerScore>} scores Scores set during the currently ongoing match, or the previous match. Emptied when a new match starts. Sorted by pass and score once match is finished.
*/
classBanchoLobbyextendsEventEmitter{
constructor(channel){
@@ -30,6 +31,7 @@ class BanchoLobby extends EventEmitter {
// Due to players resolving, matchFinished may be emitted and scores sorted before every playerFinished are done being processed.
// For some reason, even though a Promise may not have anything async, the "then" functions may still be executed asynchronously...
// However, they seem to be executed in order for some reason. So a workaround for this is to wait for the callback of a resolved Promise to be called.
Promise.resolve().then(()=>{
// This ensures sorting/emitting is executed after all names are resolved.
this.pushPlayerCreationQueue(()=>{
this.sortScores();
this.emit(regex.name,this.scores);
this.playersCreationCallback();
});
});
break;
case"invalidBeatmapId":
case"passwordRemoved":
@@ -944,6 +961,24 @@ class BanchoLobby extends EventEmitter {