Пример #1
0
  // Lists the specified details type of the specified table. If no table is specified, lists
  // details of the table that the player is sitting on.
  @Override
  public boolean conditions() {
    // cards details 5
    if (getArgs().length == 2) {
      int tableID = NumberMethods.getInteger(getArgs()[1]);
      if (tableID != -99999) {
        cardsTable = CardsTable.getTable(tableID);
        if (cardsTable != null) return true;
        else {
          ErrorMessages.notTable(getPlayer(), getArgs()[1]);
        }
      } else {
        ErrorMessages.invalidNumber(getPlayer(), getArgs()[1]);
      }
    }

    // cards details
    else if (getArgs().length == 1) {
      CardsPlayer cardsPlayer = CardsPlayer.getCardsPlayer(getPlayer().getName());
      if (cardsPlayer != null) {
        cardsTable = cardsPlayer.getTable();
        return true;
      } else {
        ErrorMessages.notSittingAtTable(getPlayer());
      }
    } else {
      showUsage();
    }

    return false;
  }
Пример #2
0
 public static PokerPlayer getPokerPlayer(String name) {
   CardsPlayer cardsPlayer = CardsPlayer.getCardsPlayer(name);
   return cardsPlayer instanceof PokerPlayer
       ? (PokerPlayer) CardsPlayer.getCardsPlayer(name)
       : null;
 }