= 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
+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
private static final String startupStyleKey = "mode";
private KittyStartupMode startupStyleValue = KittyStartupMode.Development;
private KittyStartupMode startupStyleValue = KittyStartupMode.Dev;
// Constructor
public ConfigGlobals()
@@ -49,9 +49,9 @@ public class ConfigGlobals implements IConfigSection
// Parse startup style
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;
}
}
@@ -61,7 +61,7 @@ public class ConfigGlobals implements IConfigSection
public List<ConfigItem> produce()
{
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;
}
+9 -2
View File
@@ -20,6 +20,7 @@ import dataStructures.KittyCore;
import dataStructures.KittyGuild;
import dataStructures.KittyRating;
import dataStructures.KittyRole;
import dataStructures.KittyStartupMode;
import dataStructures.KittyUser;
import main.Main;
import net.dv8tion.jda.core.AccountType;
@@ -382,9 +383,15 @@ public class ObjectBuilderFactory
{
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)
.setToken(Ref.TestToken).buildBlocking();
kitty.getPresence().setGame(Game.playing("with digital yarn"));
.setToken(tokenToUse).buildBlocking();
kitty.getPresence().setGame(Game.playing("with a laser pointer"));
kitty.addEventListener(new Main());
return new KittyCore(kitty);
+4 -4
View File
@@ -2,15 +2,15 @@ package dataStructures;
public enum KittyStartupMode
{
Development("dev"), Release("release");
Dev(1), Release(2);
private final String value;
private KittyStartupMode(String value)
private final int value;
private KittyStartupMode(int value)
{
this.value = value;
}
public String getValue()
public int getValue()
{
return value;
}