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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Called 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.void
hit
(BlackJackPlayer currentPlayer, BlackJackPlayer nextPlayer) Hit the player and give him a new card.void
joinGame
(GamePlayer user) Called when a User wants to join the Game.void
leaveGame
(GamePlayer user) Called when a User wants to leave the Game.void
onButtonInteractionReceive
(net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent buttonInteractionEvent) Called when a Button is clicked.void
stand
(BlackJackPlayer currentPlayer, BlackJackPlayer nextPlayer) Stand the player and let the other player play.void
Called when the Game is started.void
stopGame()
Called when the Game is stopped.void
stopGame
(BlackJackPlayer currentPlayer, BlackJackPlayer nextPlayer) Stop the game and check who won.void
updateViews
(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, wait
Methods 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:IGame
Called when the Game is created.- Specified by:
createGame
in interfaceIGame
-
startGame
public void startGame()Description copied from interface:IGame
Called when the Game is started. -
joinGame
Description copied from interface:IGame
Called when a User wants to join the Game. -
leaveGame
Description copied from interface:IGame
Called 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:IGame
Called when a Button is clicked.- Specified by:
onButtonInteractionReceive
in 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:IGame
Called when the Game is stopped.
-