Merge pull request #6160 from phulin/rejoin2

Send message to client to force rejoin [don't merge]
This commit is contained in:
Oleg Agafonov 2020-01-14 01:48:24 +01:00 committed by GitHub
commit 85ac603070
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -333,9 +333,14 @@ public class GameController implements GameCallback {
// TODO: workaround to fix not started games in tourneys, need to find out real reason // TODO: workaround to fix not started games in tourneys, need to find out real reason
if (gameSessions.get(player.getId()) == null) { if (gameSessions.get(player.getId()) == null) {
// join the game because player has not joined are was removed because of disconnect // join the game because player has not joined are was removed because of disconnect
user.removeConstructing(player.getId()); if (user.isConnected()) {
GameManager.instance.joinGame(game.getId(), user.getId()); user.ccGameStarted(game.getId(), player.getId());
logger.warn("Forced join of player " + player.getName() + " (" + user.getUserState() + ") to gameId: " + game.getId()); logger.warn("Player " + player.getName() + " (missed message) has joined gameId: " + game.getId());
} else {
user.removeConstructing(player.getId());
GameManager.instance.joinGame(game.getId(), user.getId());
logger.warn("Forced join of player " + player.getName() + " (" + user.getUserState() + ") to gameId: " + game.getId());
}
ChatManager.instance.broadcast(chatId, player.getName(), user.getPingInfo() ChatManager.instance.broadcast(chatId, player.getName(), user.getPingInfo()
+ " is forced to join the game (waiting ends after " + " is forced to join the game (waiting ends after "
+ GAME_TIMEOUTS_CANCEL_PLAYER_GAME_JOINING_AFTER_INACTIVE_SECS + " secs)", + GAME_TIMEOUTS_CANCEL_PLAYER_GAME_JOINING_AFTER_INACTIVE_SECS + " secs)",