use of irc.account.Task in project Botnak by Gocnak.
the class Settings method loadPropData.
/**
* *********VOIDS*************
*/
public static void loadPropData(int type) {
Properties p = new Properties();
if (type == 0) {
//accounts
try {
p.load(new FileInputStream(accountsFile));
String userNorm = p.getProperty("UserNorm", "").toLowerCase();
String userNormPass = p.getProperty("UserNormPass", "");
String status = p.getProperty("CanStatus", "false");
String commercial = p.getProperty("CanCommercial", "false");
if (!userNorm.equals("") && !userNormPass.equals("") && userNormPass.contains("oauth")) {
boolean stat = Boolean.parseBoolean(status);
if (!stat) {
GUIMain.instance.updateStatusOption.setEnabled(false);
GUIMain.instance.updateStatusOption.setToolTipText("Enable \"Edit Title and Game\" in the Authorize GUI to use this feature.");
}
boolean ad = Boolean.parseBoolean(commercial);
if (!ad) {
GUIMain.instance.runAdMenu.setEnabled(false);
GUIMain.instance.runAdMenu.setToolTipText("Enable \"Play Commercials\" in the Authorize GUI to use this feature.");
}
boolean subs = Boolean.parseBoolean(p.getProperty("CanParseSubscribers", "false"));
boolean followed = Boolean.parseBoolean(p.getProperty("CanParseFollowedStreams", "false"));
if (followed)
trackFollowers.setValue(true);
accountManager.setUserAccount(new Account(userNorm, new Oauth(userNormPass, stat, ad, subs, followed)));
}
String userBot = p.getProperty("UserBot", "").toLowerCase();
String userBotPass = p.getProperty("UserBotPass", "");
if (!userBot.equals("") && !userBotPass.equals("") && userBotPass.contains("oauth")) {
accountManager.setBotAccount(new Account(userBot, new Oauth(userBotPass, false, false, false, false)));
}
if (accountManager.getUserAccount() != null) {
accountManager.addTask(new Task(null, Task.Type.CREATE_VIEWER_ACCOUNT, null));
}
if (accountManager.getBotAccount() != null) {
accountManager.addTask(new Task(null, Task.Type.CREATE_BOT_ACCOUNT, null));
}
} catch (Exception e) {
GUIMain.log(e);
}
}
if (type == 1) {
//defaults
try {
p.load(new FileInputStream(defaultsFile));
settings.forEach(s -> s.load(p));
if (logChat.getValue())
logDir.mkdirs();
GUIMain.log("Loaded defaults!");
} catch (Exception e) {
GUIMain.log(e);
}
}
}