Package org.cspoker.common.elements.player

Examples of org.cspoker.common.elements.player.SeatedPlayer


   * @return
   * @see org.cspoker.client.common.gamestate.GameState#getPlayer(org.cspoker.common.elements.player.PlayerId)
   */
  @Override
  public PlayerState getPlayer(PlayerId playerId) {
    SeatedPlayer selected = null;
    for (SeatedPlayer seated : table.getPlayers()) {
      if (seated.getId().equals(playerId)) {
        selected = seated;
      }
    }
    if (selected == null || !selected.isSittingIn()) {
      return null;
    }
    return new SeatedPlayerState(selected);
  }
View Full Code Here


    private List<SeatedPlayer> arrivedPlayers = Collections.synchronizedList(new ArrayList<SeatedPlayer>());

    @Override
    public void onPlayerArrive(PlayerArrive a) {
      SeatedPlayer player = new SeatedPlayer(
          getId(a),
          new SeatId(a.getSeat()),
          a.getName(),
          0,0,false,false);
      arrivedPlayers.add(player);
View Full Code Here

        }

        ///update arrivedPlayers
        ListIterator<SeatedPlayer> iter = arrivedPlayers.listIterator();
        while(iter.hasNext()){
          SeatedPlayer prevPlayer = iter.next();
          if(prevPlayer.getId().equals(id)){
            iter.remove();
            iter.add(new SeatedPlayer(prevPlayer, playerChips.getMoney(), playerChips.getBet()));
            return;
          }
        }
        throw new IllegalStateException();
      } catch (NullPointerException e) {
View Full Code Here

        logger.warn("Ignoring superfluous "+sit+" because player is already sitting in.");
        return;
      }
      Iterator<SeatedPlayer> iter = arrivedPlayers.iterator();
      while(iter.hasNext()){
        SeatedPlayer sitter = iter.next();
        if(sitter.getId().equals(id)) {
          // set the sitting in flag to true
          dispatch(new SitInEvent(new SeatedPlayer(sitter, true)));
          return;
        }
      }
      throw new IllegalStateException();
    }
View Full Code Here

      List<SeatedPlayer> players = new ArrayList<SeatedPlayer>();
      PlayerId dealerId = null;
      //only send players that actually sit in AND are ingame in the new deal event.
      for(int i:dealtTo){
        PlayerState p = getGameState().getPlayer(new PlayerId(i));
        players.add(new SeatedPlayer(p.getPlayerId(),p.getSeatId(),p.getName(),p.getStack(), p.getBet(), true, false));
        if(p.getSeatId().getId() == dealer.getDealer()){
          dealerId = p.getPlayerId();
        }
      }
      if(dealerId == null) throw new IllegalSelectorException();
View Full Code Here

TOP

Related Classes of org.cspoker.common.elements.player.SeatedPlayer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.