diff --git a/src/main/java/wtf/beatrice/hidekobot/Cache.java b/src/main/java/wtf/beatrice/hidekobot/Cache.java index 1fa3604..09954e0 100644 --- a/src/main/java/wtf/beatrice/hidekobot/Cache.java +++ b/src/main/java/wtf/beatrice/hidekobot/Cache.java @@ -217,7 +217,7 @@ public class Cache public static long getExpiryTimeSeconds() { return expiryTimeSeconds; } - public static String getBotName() { return botName; }; + public static String getBotName() { return botName; } /** * Get the bot's version. diff --git a/src/main/java/wtf/beatrice/hidekobot/HidekoBot.java b/src/main/java/wtf/beatrice/hidekobot/HidekoBot.java index 43794c0..b034987 100644 --- a/src/main/java/wtf/beatrice/hidekobot/HidekoBot.java +++ b/src/main/java/wtf/beatrice/hidekobot/HidekoBot.java @@ -192,13 +192,13 @@ public class HidekoBot // start scheduled runnables ScheduledExecutorService scheduler = Cache.getTaskScheduler(); ExpiredMessageTask expiredMessageTask = new ExpiredMessageTask(); - scheduler.scheduleAtFixedRate(expiredMessageTask, 5, 5, TimeUnit.SECONDS); //every 5 seconds + scheduler.scheduleAtFixedRate(expiredMessageTask, 5L, 5L, TimeUnit.SECONDS); //every 5 seconds HeartBeatTask heartBeatTask = new HeartBeatTask(); - scheduler.scheduleAtFixedRate(heartBeatTask, 10, 30, TimeUnit.SECONDS); //every 30 seconds + scheduler.scheduleAtFixedRate(heartBeatTask, 10L, 30L, TimeUnit.SECONDS); //every 30 seconds StatusUpdateTask statusUpdateTask = new StatusUpdateTask(); - scheduler.scheduleAtFixedRate(statusUpdateTask, 0, 60 * 5, TimeUnit.SECONDS); // every 5 minutes + scheduler.scheduleAtFixedRate(statusUpdateTask, 0L, 60L * 5L, TimeUnit.SECONDS); // every 5 minutes RandomSeedTask randomSeedTask = new RandomSeedTask(); - scheduler.scheduleAtFixedRate(randomSeedTask, 0, 60, TimeUnit.SECONDS); // every minute + scheduler.scheduleAtFixedRate(randomSeedTask, 0L, 60L, TimeUnit.SECONDS); // every minute // register shutdown interrupt signal listener for proper shutdown. Signal.handle(new Signal("INT"), signal -> shutdown()); diff --git a/src/main/java/wtf/beatrice/hidekobot/commands/base/DiceRoll.java b/src/main/java/wtf/beatrice/hidekobot/commands/base/DiceRoll.java index aff4c34..9726716 100644 --- a/src/main/java/wtf/beatrice/hidekobot/commands/base/DiceRoll.java +++ b/src/main/java/wtf/beatrice/hidekobot/commands/base/DiceRoll.java @@ -8,6 +8,7 @@ import wtf.beatrice.hidekobot.objects.fun.Dice; import java.util.LinkedHashMap; import java.util.LinkedList; +import java.util.Map; import java.util.UUID; public class DiceRoll @@ -15,8 +16,8 @@ public class DiceRoll public static MessageResponse buildResponse(User author, String[] args) { LinkedHashMap dicesToRoll = new LinkedHashMap<>(); - String diceRegex = "d[0-9]+"; - String amountRegex = "[0-9]+"; + String diceRegex = "d\\d+"; + String amountRegex = "\\d+"; Dice currentDice = null; int currentAmount; @@ -106,9 +107,12 @@ public class DiceRoll totalRolls = 1; } - for(Dice dice : dicesToRoll.keySet()) + for(Map.Entry entry : dicesToRoll.entrySet()) { - for(int roll = 0; roll < dicesToRoll.get(dice); roll++) + Dice dice = entry.getKey(); + Integer rollsToMake = entry.getValue(); + + for(int roll = 0; roll < rollsToMake; roll++) { dice.roll(); rolledDices.add(new Dice(dice)); diff --git a/src/main/java/wtf/beatrice/hidekobot/datasources/ConfigurationSource.java b/src/main/java/wtf/beatrice/hidekobot/datasources/ConfigurationSource.java index ab3ff71..d79695a 100644 --- a/src/main/java/wtf/beatrice/hidekobot/datasources/ConfigurationSource.java +++ b/src/main/java/wtf/beatrice/hidekobot/datasources/ConfigurationSource.java @@ -11,8 +11,6 @@ import java.util.LinkedHashMap; public class ConfigurationSource { - - private final LinkedHashMap configurationEntries = new LinkedHashMap<>(); private final Logger logger; private final String configFilePath;