From b960fd0101a7199f0c48f13dc1ab50a86f1c05ae Mon Sep 17 00:00:00 2001 From: Matthew Cech Date: Thu, 12 Sep 2019 22:48:24 -0700 Subject: [PATCH] + Added ability to change bet threshold from config file --- src/commands/general/CommandBetBeans.java | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/commands/general/CommandBetBeans.java b/src/commands/general/CommandBetBeans.java index 25e0eb9..bcb14b0 100644 --- a/src/commands/general/CommandBetBeans.java +++ b/src/commands/general/CommandBetBeans.java @@ -5,6 +5,8 @@ import java.util.Random; import core.Command; import core.LocStrings; import dataStructures.*; +import utils.GlobalLog; +import utils.LogFilter; public class CommandBetBeans extends Command { @@ -17,12 +19,30 @@ public class CommandBetBeans extends Command public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res) { String call = ""; + + int min = 50; int bet = 0; int win = 0; + + try + { + String valAsString = LocStrings.stub("BetBeansMinThreshold"); + int parsed = Integer.parseInt(valAsString); + + if(parsed < 0) + parsed = 0; + + min = parsed; + } + catch (Exception e) + { + GlobalLog.log(LogFilter.Command, "Betting took place, but a value was not specified in the config file so 50 was used as the minimum bet threshold. Consider specifying BetBeansMinThreshold."); + } + try { bet = Integer.parseInt(input.args); - if(bet < 50) + if(bet < min) { res.send(LocStrings.stub("BetBeansLowBet")); return;