use of tk.ardentbot.utils.games.Hand in project Ardent by adamint.
the class Blackjack method noArgs.
@Override
public void noArgs(Guild guild, MessageChannel channel, User user, Message message, String[] args) throws Exception {
if (sessions.contains(user.getId()))
return;
sendTranslatedMessage("Enter an amount to bet", channel, user);
interactiveOperation(channel, message, betMessage -> {
try {
int amountToBet = Integer.parseInt(betMessage.getContent());
Profile profile = Profile.get(user);
if (amountToBet <= 0 || profile.getMoney() < amountToBet) {
sendTranslatedMessage("You entered an invalid amount of money", channel, user);
return;
} else if (amountToBet > 5000) {
sendTranslatedMessage("The max bet is **$5,000**!", channel, user);
return;
}
Hand yourHand = new Hand().generate().generate();
Hand dealerHand = new Hand().generate().generate();
sessions.add(user.getId());
dispatchRound(amountToBet, yourHand, dealerHand, guild, channel, user, message, args);
} catch (Exception e) {
sendTranslatedMessage("You need to enter a whole number. Cancelling...", channel, user);
}
});
}
Aggregations