}
@Override
public void joinTableCommandReceived(JoinTableCommand command)
{
GameTCPServer client = null;
final PokerGame game = m_lobby.getGame(command.getTableID());
if (game.getClass().equals(PokerGameTraining.class))
{
final PokerGameTraining tgame = (PokerGameTraining) game;
client = new GameTCPServer(game, m_playerName, tgame.getTrainingTable().getStartingMoney());
}
else
{
client = new GameTCPServer(game, DataManager.Persistance.get(command.getPlayerName()));
}
final TableInfo table = game.getTable();
if (!game.isRunning())
{
sendMessage(command.encodeErrorResponse());
return;
}
// Verify the player does not already playing on that table.
if (!table.containsPlayer(command.getPlayerName()))
{
final boolean ok = client.joinGame();
if (!ok)
{
sendMessage(command.encodeErrorResponse());
}
else
{
m_tables.put(command.getTableID(), client);
client.start();
sendMessage(command.encodeResponse(client.getPlayer().getNoSeat()));
client.sitIn();
new ServerClientSender(command.getTableID(), client, ServerClientLobby.this).start();
}
}
else
{