Class Blackjack

java.lang.Object
de.presti.ree6.game.impl.blackjack.Blackjack
All Implemented Interfaces:
IGame

public class Blackjack extends Object implements IGame
Class used to represent the game of blackjack.
  • Constructor Details

    • Blackjack

      public Blackjack(GameSession gameSession)
      Constructor.
      Parameters:
      gameSession - The game session.
  • Method Details

    • createGame

      public void createGame()
      Description copied from interface: IGame
      Called when the Game is created.
      Specified by:
      createGame in interface IGame
    • startGame

      public void startGame()
      Description copied from interface: IGame
      Called when the Game is started.
      Specified by:
      startGame in interface IGame
    • joinGame

      public void joinGame(GamePlayer user)
      Description copied from interface: IGame
      Called when a User wants to join the Game.
      Specified by:
      joinGame in interface IGame
      Parameters:
      user - The User who wants to join.
    • leaveGame

      public void leaveGame(GamePlayer user)
      Description copied from interface: IGame
      Called when a User wants to leave the Game.
      Specified by:
      leaveGame in interface IGame
      Parameters:
      user - The User who wants to leave.
    • onButtonInteractionReceive

      public void onButtonInteractionReceive(net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent buttonInteractionEvent)
      Description copied from interface: IGame
      Called when a Button is clicked.
      Specified by:
      onButtonInteractionReceive in interface IGame
      Parameters:
      buttonInteractionEvent - The Event.
    • getRandomCard

      public BlackJackCard getRandomCard()
      Get a random card from the basic Deck, but check if the card is already a players hand.
      Returns:
      The random card.
    • hit

      public void hit(BlackJackPlayer currentPlayer, BlackJackPlayer nextPlayer)
      Hit the player and give him a new card.
      Parameters:
      currentPlayer - The player who hit.
      nextPlayer - The other player.
    • stand

      public void stand(BlackJackPlayer currentPlayer, BlackJackPlayer nextPlayer)
      Stand the player and let the other player play.
      Parameters:
      currentPlayer - The player who stand.
      nextPlayer - The other player.
    • stopGame

      public void stopGame(BlackJackPlayer currentPlayer, BlackJackPlayer nextPlayer)
      Stop the game and check who won.
      Parameters:
      currentPlayer - The player who won.
      nextPlayer - The other player.
    • updateViews

      public void updateViews(BlackJackPlayer currentPlayer, BlackJackPlayer nextPlayer)
      Called to update the current Views of all Players.
      Parameters:
      currentPlayer - The current player.
      nextPlayer - The next player.
    • findWinner

      public BlackJackPlayer findWinner()
      Determine the winner of the game.
      Returns:
      The winner of the game.
    • stopGame

      public void stopGame()
      Description copied from interface: IGame
      Called when the Game is stopped.
      Specified by:
      stopGame in interface IGame