Example #1
0
  public void payPot(int divide) {
    double potToPay = getPot() / divide;
    double rake = 0;
    PokerTable pokerTable = getPokerTable();
    if (pokerTable.getSettings().rake.getValue() > 0) {
      rake = potToPay * pokerTable.getSettings().rake.getValue();

      UltimateCards.getEconomy().depositPlayer(pokerTable.getOwner(), rake);
      Log.addToLog(
          DateMethods.getDate() + " [ECONOMY] Depositing " + rake + " to " + pokerTable.getOwner());
    }

    pokerTable.sendTableMessage(
        "&6"
            + getPlayerName()
            + "&f wins &6"
            + Formatter.formatMoney(potToPay - rake)
            + (pokerTable.getSettings().rake.getValue() > 0
                ? "&f - Rake " + Formatter.formatMoney(rake)
                : ""));

    // Get the actual amount that the player wins by subtracting the rake from the pot, then give it
    // to the player's stack
    giveMoney(potToPay - rake);

    for (PokerPlayer p : pokerTable.getNonFoldedPlayers()) {
      p.setPot(p.getPot() - potToPay);
    }

    Sound.won(getPlayer());
  }
Example #2
0
  public void fold() {
    setActed(true);
    setFolded(true);
    setTotalBet(0);
    getTable().sendTableMessage("&6" + getPlayerName() + "&f folds.");
    Sound.lost(getPlayer());

    cancelTurnTimer();

    // If there is only 1 non-folded player left, announce him the winner
    if (getPokerTable().getNonFoldedPlayers().size() == 1) {
      getPokerTable().endPhaseForPlayers();
      getPokerTable().phaseHandEnd();
      return;
    }
    if (getPokerTable().getActionPlayer() == this) {
      getPokerTable().nextPersonTurn(this);
    }
  }