Skip to content

Commit d47fd9a

Browse files
authored
Ready check (#2567)
kicking a player caused the readyCheck object to clear, causing seemingly random kicks. this has been fixed.
1 parent 126af9c commit d47fd9a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Games/core/Game.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -996,16 +996,21 @@ module.exports = class Game {
996996
}
997997

998998
failReadyCheck() {
999+
const playersToKick = [];
9991000
for (let player of this.players) {
10001001
if (!this.readyPlayers[player.id]) {
1001-
this.kickPlayer(player);
1002-
this.sendAlert(
1002+
playersToKick.push(player);
1003+
}
1004+
}
1005+
1006+
for (let player of playersToKick) {
1007+
this.kickPlayer(player);
1008+
this.sendAlert(
10031009
`${player.name} was kicked for inactivity.`,
10041010
undefined,
10051011
undefined,
10061012
["info"]
1007-
);
1008-
}
1013+
);
10091014
}
10101015

10111016
this.cancelReadyCheck();

0 commit comments

Comments
 (0)