Class Blackjack
java.lang.Object
de.presti.ree6.game.impl.blackjack.Blackjack
- All Implemented Interfaces:
IGame
Class used to represent the game of blackjack.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled when the Game is created.Determine the winner of the game.Get a random card from the basic Deck, but check if the card is already a players hand.voidhit(BlackJackPlayer currentPlayer, BlackJackPlayer nextPlayer) Hit the player and give him a new card.voidjoinGame(GamePlayer user) Called when a User wants to join the Game.voidleaveGame(GamePlayer user) Called when a User wants to leave the Game.voidonButtonInteractionReceive(net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent buttonInteractionEvent) Called when a Button is clicked.voidstand(BlackJackPlayer currentPlayer, BlackJackPlayer nextPlayer) Stand the player and let the other player play.voidCalled when the Game is started.voidstopGame()Called when the Game is stopped.voidstopGame(BlackJackPlayer currentPlayer, BlackJackPlayer nextPlayer) Stop the game and check who won.voidupdateViews(BlackJackPlayer currentPlayer, BlackJackPlayer nextPlayer) Called to update the current Views of all Players.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.presti.ree6.game.core.base.IGame
onMessageReceive, onReactionReceive, rewardPlayer
-
Constructor Details
-
Blackjack
Constructor.- Parameters:
gameSession- The game session.
-
-
Method Details
-
createGame
public void createGame()Description copied from interface:IGameCalled when the Game is created.- Specified by:
createGamein interfaceIGame
-
startGame
public void startGame()Description copied from interface:IGameCalled when the Game is started. -
joinGame
Description copied from interface:IGameCalled when a User wants to join the Game. -
leaveGame
Description copied from interface:IGameCalled when a User wants to leave the Game. -
onButtonInteractionReceive
public void onButtonInteractionReceive(net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent buttonInteractionEvent) Description copied from interface:IGameCalled when a Button is clicked.- Specified by:
onButtonInteractionReceivein interfaceIGame- Parameters:
buttonInteractionEvent- The Event.
-
getRandomCard
Get a random card from the basic Deck, but check if the card is already a players hand.- Returns:
- The random card.
-
hit
Hit the player and give him a new card.- Parameters:
currentPlayer- The player who hit.nextPlayer- The other player.
-
stand
Stand the player and let the other player play.- Parameters:
currentPlayer- The player who stand.nextPlayer- The other player.
-
stopGame
Stop the game and check who won.- Parameters:
currentPlayer- The player who won.nextPlayer- The other player.
-
updateViews
Called to update the current Views of all Players.- Parameters:
currentPlayer- The current player.nextPlayer- The next player.
-
findWinner
Determine the winner of the game.- Returns:
- The winner of the game.
-
stopGame
public void stopGame()Description copied from interface:IGameCalled when the Game is stopped.
-