= Updated config

This commit is contained in:
Matthew Cech
2019-11-02 19:29:02 -08:00
parent 7f2251732e
commit 74a5750824
4 changed files with 19 additions and 10 deletions
+2
View File
@@ -1,4 +1,5 @@
"Type","Key","Value" "Type","Key","Value"
"Globals","mode","dev"
"Localized Commands","beans","" "Localized Commands","beans",""
"Localized Commands","benchmark, bench","" "Localized Commands","benchmark, bench",""
"Localized Commands","bet","" "Localized Commands","bet",""
@@ -61,6 +62,7 @@
"Localized Strings","BetBeansInfo","Allows you to bet your beans, set your amount after the command! Warning! House always wins!nSets of 3 will get 2x, 4 will get 10x, and 5 will get 1000x" "Localized Strings","BetBeansInfo","Allows you to bet your beans, set your amount after the command! Warning! House always wins!nSets of 3 will get 2x, 4 will get 10x, and 5 will get 1000x"
"Localized Strings","BetBeansLose","Sorry, you didn't win, try again!" "Localized Strings","BetBeansLose","Sorry, you didn't win, try again!"
"Localized Strings","BetBeansLowBet","Please bet with at least 20 beans!" "Localized Strings","BetBeansLowBet","Please bet with at least 20 beans!"
"Localized Strings","BetBeansMinThreshold",""
"Localized Strings","BetBeansNotEnough","You don't have enough beans!" "Localized Strings","BetBeansNotEnough","You don't have enough beans!"
"Localized Strings","BetBeansNotValid","That's not a valid bet!" "Localized Strings","BetBeansNotValid","That's not a valid bet!"
"Localized Strings","BetBeansWin","You won %s beans!" "Localized Strings","BetBeansWin","You won %s beans!"
1 Type Key Value
2 Globals mode dev
3 Localized Commands beans
4 Localized Commands benchmark, bench
5 Localized Commands bet
62 Localized Strings BetBeansInfo Allows you to bet your beans, set your amount after the command! Warning! House always wins!nSets of 3 will get 2x, 4 will get 10x, and 5 will get 1000x
63 Localized Strings BetBeansLose Sorry, you didn't win, try again!
64 Localized Strings BetBeansLowBet Please bet with at least 20 beans!
65 Localized Strings BetBeansMinThreshold
66 Localized Strings BetBeansNotEnough You don't have enough beans!
67 Localized Strings BetBeansNotValid That's not a valid bet!
68 Localized Strings BetBeansWin You won %s beans!
+4 -4
View File
@@ -16,7 +16,7 @@ public class ConfigGlobals implements IConfigSection
// A pile of variables being manually tracked/serialized to the config file // A pile of variables being manually tracked/serialized to the config file
private static final String startupStyleKey = "mode"; private static final String startupStyleKey = "mode";
private KittyStartupMode startupStyleValue = KittyStartupMode.Development; private KittyStartupMode startupStyleValue = KittyStartupMode.Dev;
// Constructor // Constructor
public ConfigGlobals() public ConfigGlobals()
@@ -49,9 +49,9 @@ public class ConfigGlobals implements IConfigSection
// Parse startup style // Parse startup style
if(key.equalsIgnoreCase(startupStyleKey)) if(key.equalsIgnoreCase(startupStyleKey))
{ {
startupStyleValue = KittyStartupMode.Development; startupStyleValue = KittyStartupMode.Dev;
if(value.equalsIgnoreCase(KittyStartupMode.Release.getValue())) if(value.equalsIgnoreCase(KittyStartupMode.Release.name()))
startupStyleValue = KittyStartupMode.Release; startupStyleValue = KittyStartupMode.Release;
} }
} }
@@ -61,7 +61,7 @@ public class ConfigGlobals implements IConfigSection
public List<ConfigItem> produce() public List<ConfigItem> produce()
{ {
List<ConfigItem> items = new ArrayList<ConfigItem>(); List<ConfigItem> items = new ArrayList<ConfigItem>();
items.add(new ConfigItem(getSectionTitle(), startupStyleKey, startupStyleValue.getValue())); items.add(new ConfigItem(getSectionTitle(), startupStyleKey, startupStyleValue.name().toLowerCase()));
return items; return items;
} }
+9 -2
View File
@@ -20,6 +20,7 @@ import dataStructures.KittyCore;
import dataStructures.KittyGuild; import dataStructures.KittyGuild;
import dataStructures.KittyRating; import dataStructures.KittyRating;
import dataStructures.KittyRole; import dataStructures.KittyRole;
import dataStructures.KittyStartupMode;
import dataStructures.KittyUser; import dataStructures.KittyUser;
import main.Main; import main.Main;
import net.dv8tion.jda.core.AccountType; import net.dv8tion.jda.core.AccountType;
@@ -382,9 +383,15 @@ public class ObjectBuilderFactory
{ {
lazyInit(); lazyInit();
// Determine token based on config. Default to test token.
String tokenToUse = Ref.TestToken;
if(ConfigGlobals.getStartupMode() == KittyStartupMode.Release)
tokenToUse = Ref.Token;
// Construct bot based on token
kitty = new JDABuilder(AccountType.BOT) kitty = new JDABuilder(AccountType.BOT)
.setToken(Ref.TestToken).buildBlocking(); .setToken(tokenToUse).buildBlocking();
kitty.getPresence().setGame(Game.playing("with digital yarn")); kitty.getPresence().setGame(Game.playing("with a laser pointer"));
kitty.addEventListener(new Main()); kitty.addEventListener(new Main());
return new KittyCore(kitty); return new KittyCore(kitty);
+4 -4
View File
@@ -2,15 +2,15 @@ package dataStructures;
public enum KittyStartupMode public enum KittyStartupMode
{ {
Development("dev"), Release("release"); Dev(1), Release(2);
private final String value; private final int value;
private KittyStartupMode(String value) private KittyStartupMode(int value)
{ {
this.value = value; this.value = value;
} }
public String getValue() public int getValue()
{ {
return value; return value;
} }