* TableController - Removed unneccessary warinings.

This commit is contained in:
LevelX2 2013-09-28 14:37:10 +02:00
parent 2b18ed76cb
commit 50056df24e

View file

@ -743,27 +743,18 @@ public class GameController implements GameCallback {
if (gameSessions.containsKey(playerId)) { if (gameSessions.containsKey(playerId)) {
command.execute(playerId); command.execute(playerId);
} }
} // otherwise execute the action under other player's control } else {
else { // otherwise execute the action under other player's control
//System.out.println("asThough: " + playerId + " " + game.getPriorityPlayerId());
Player player = game.getPlayer(playerId); Player player = game.getPlayer(playerId);
boolean found = false; if (player != null) {
for (UUID controlled : player.getPlayersUnderYourControl()) { for (UUID controlled : player.getPlayersUnderYourControl()) {
if (gameSessions.containsKey(controlled) && game.getPriorityPlayerId().equals(controlled)) { if (gameSessions.containsKey(controlled) && game.getPriorityPlayerId().equals(controlled)) {
command.execute(controlled); command.execute(controlled);
found = true; }
} }
} }
if (!found) { // else player has no priority to do something, so ignore the command
// something wrong - it may cause game freezes // e.g. you click at one of your cards, but you can't play something at that moment
logger.warn("WARNING! GameController.sendMessage - couldn't find session for action execution. Player: " + player.getName());
// log additional information
logger.warn(" action player: " + player.getName() + ", id: " + player.getId());
Player priorityPlayer = game.getPlayer(game.getPriorityPlayerId());
logger.warn(" priority player: " + priorityPlayer.getName() + ", id: " + priorityPlayer.getId());
logger.warn(" command: " + command.toString());
logger.warn(" command-class: " + command.getClass().getName());
}
} }
} else { } else {
// ignore - no control over the turn // ignore - no control over the turn