* Document the handleMessage method
*
* @param message
*/
public void handleMessage(Message message) {
MessageType mt = message.getMessageType();
_logger.info("got " + mt);
List<MessageParam> mps = message.getMsgParams();
if(mt.equals(MessageType.GAME_OVER)) {
Collection<String> playerNames = getPlayerNames(mps);
Collection<Integer> ids = getPlayerIds(mps);
listener.handleGameOver(new GameOverEvent(ids, playerNames));
} else if(mt.equals(MessageType.HAND_DEALT)) {
int id = getPlayerId(mps);
listener.handleHandDealt(new HandDealtEvent(id));
} else if(mt.equals(MessageType.NEW_GAME)) {
List<String> playerNames = getPlayerNames(mps);
List<Integer> ids = getPlayerIds(mps);
listener.handleNewGame(new NewGameEvent(ids, playerNames));
} else if(mt.equals(MessageType.NEW_ROUND)) {
int round = getInt(mps, MessageParamConstants.ROUND);
listener.handleNewRound(new NewRoundEvent(round));
} else if(mt.equals(MessageType.NEW_TRICK)) {
listener.handleNewTrick(new NewTrickEvent());
} else if(mt.equals(MessageType.NEW_TRUMP)) {
Card card = getCard(mps);
listener.handleNewTrump(new NewTrumpEvent(card));
} else if(mt.equals(MessageType.PLAYER_BID)) {
int bid = getInt(mps, MessageParamConstants.BID);
int id = getPlayerId(mps);
listener.handlePlayerBid(new PlayerBidEvent(id, bid));
} else if(mt.equals(MessageType.PLAYER_PLAYED)) {
Card card = getCard(mps);
int id = getPlayerId(mps);
listener.handlePlayerPlayed(new PlayerPlayedEvent(id, card));
} else if(mt.equals(MessageType.PLAYER_WON_TRICK)) {
int id = getPlayerId(mps);
Card card = getCard(mps);
listener.handlePlayerWonTrick(new PlayerWonTrickEvent(id, card));
} else if(mt.equals(MessageType.SCORE_EVENT)) {
int score = getInt(mps, MessageParamConstants.SCORE);
int id = getPlayerId(mps);
listener.handleScore(new ScoreEvent(id, score));
} else if(mt.equals(MessageType.PLAYER_NEEDS_TO_PLAY)) {
int id = getPlayerId(mps);
listener.handlePlayerNeedsToPlay(new PlayerNeedsToPlay(id));
}
}