Attempt to allow players to fix the game if the active/choosing/person with priority has left or has run down the clock

This commit is contained in:
spjspj 2018-04-02 19:31:05 +10:00
parent 7698856d29
commit 471d49892f
2 changed files with 101 additions and 2 deletions

View file

@ -244,6 +244,27 @@ public enum ChatManager {
}
return true;
}
if (command.startsWith("FIX")) {
message += "<br/>" + GameManager.instance.getChatId(chatId);
ChatSession session = chatSessions.get(chatId);
if (session != null && session.getInfo() != null) {
String gameId = session.getInfo();
if (gameId.startsWith("Game ")) {
UUID id = java.util.UUID.fromString(gameId.substring(5, gameId.length()));
for (Entry<UUID, GameController> entry : GameManager.instance.getGameController().entrySet()) {
if (entry.getKey().equals(id)) {
GameController controller = entry.getValue();
if (controller != null) {
message += controller.attemptToFixGame();
chatSessions.get(chatId).broadcastInfoToUser(user, message);
}
}
}
}
}
return true;
}
if (command.startsWith("CARD ")) {
Matcher matchPattern = getCardTextPattern.matcher(message.toLowerCase(Locale.ENGLISH));
if (matchPattern.find()) {