Make multiple small improvements
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
fb752fb9a9
commit
d6ef0da167
@ -217,7 +217,7 @@ public class Cache
|
|||||||
public static long getExpiryTimeSeconds() { return expiryTimeSeconds; }
|
public static long getExpiryTimeSeconds() { return expiryTimeSeconds; }
|
||||||
|
|
||||||
|
|
||||||
public static String getBotName() { return botName; };
|
public static String getBotName() { return botName; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the bot's version.
|
* Get the bot's version.
|
||||||
|
@ -192,13 +192,13 @@ public class HidekoBot
|
|||||||
// start scheduled runnables
|
// start scheduled runnables
|
||||||
ScheduledExecutorService scheduler = Cache.getTaskScheduler();
|
ScheduledExecutorService scheduler = Cache.getTaskScheduler();
|
||||||
ExpiredMessageTask expiredMessageTask = new ExpiredMessageTask();
|
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();
|
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();
|
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();
|
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.
|
// register shutdown interrupt signal listener for proper shutdown.
|
||||||
Signal.handle(new Signal("INT"), signal -> shutdown());
|
Signal.handle(new Signal("INT"), signal -> shutdown());
|
||||||
|
@ -8,6 +8,7 @@ import wtf.beatrice.hidekobot.objects.fun.Dice;
|
|||||||
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class DiceRoll
|
public class DiceRoll
|
||||||
@ -15,8 +16,8 @@ public class DiceRoll
|
|||||||
public static MessageResponse buildResponse(User author, String[] args)
|
public static MessageResponse buildResponse(User author, String[] args)
|
||||||
{
|
{
|
||||||
LinkedHashMap<Dice, Integer> dicesToRoll = new LinkedHashMap<>();
|
LinkedHashMap<Dice, Integer> dicesToRoll = new LinkedHashMap<>();
|
||||||
String diceRegex = "d[0-9]+";
|
String diceRegex = "d\\d+";
|
||||||
String amountRegex = "[0-9]+";
|
String amountRegex = "\\d+";
|
||||||
|
|
||||||
Dice currentDice = null;
|
Dice currentDice = null;
|
||||||
int currentAmount;
|
int currentAmount;
|
||||||
@ -106,9 +107,12 @@ public class DiceRoll
|
|||||||
totalRolls = 1;
|
totalRolls = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Dice dice : dicesToRoll.keySet())
|
for(Map.Entry<Dice, Integer> 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();
|
dice.roll();
|
||||||
rolledDices.add(new Dice(dice));
|
rolledDices.add(new Dice(dice));
|
||||||
|
@ -11,8 +11,6 @@ import java.util.LinkedHashMap;
|
|||||||
|
|
||||||
public class ConfigurationSource
|
public class ConfigurationSource
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
private final LinkedHashMap<String, Object> configurationEntries = new LinkedHashMap<>();
|
private final LinkedHashMap<String, Object> configurationEntries = new LinkedHashMap<>();
|
||||||
private final Logger logger;
|
private final Logger logger;
|
||||||
private final String configFilePath;
|
private final String configFilePath;
|
||||||
|
Loading…
Reference in New Issue
Block a user