Added some config saving code

This commit is contained in:
Norbi Peti 2016-11-05 19:21:34 +01:00
parent 19dd0f5ef5
commit 73280fa88e

View file

@ -49,6 +49,10 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
lastannouncementtime = getConfig().getLong("lastannouncementtime"); lastannouncementtime = getConfig().getLong("lastannouncementtime");
lastseentime = getConfig().getLong("lastseentime"); lastseentime = getConfig().getLong("lastseentime");
Test = getConfig().getBoolean("test", true); Test = getConfig().getBoolean("test", true);
getConfig().set("lastannouncementtime", lastannouncementtime);
getConfig().set("lastseentime", lastseentime);
getConfig().set("test", Test); // TODO: TMP
saveConfig();
} }
ClientBuilder cb = new ClientBuilder(); ClientBuilder cb = new ClientBuilder();
cb.withToken(Files.readFirstLine(new File("TBMC", "Token.txt"), StandardCharsets.UTF_8)); cb.withToken(Files.readFirstLine(new File("TBMC", "Token.txt"), StandardCharsets.UTF_8));
@ -116,6 +120,9 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
@Override @Override
public void onDisable() { public void onDisable() {
stop = true; stop = true;
getConfig().set("lastannouncementtime", lastannouncementtime);
getConfig().set("lastseentime", lastseentime);
saveConfig();
try { try {
dc.changeStatus(Status.game("on TBMC")); dc.changeStatus(Status.game("on TBMC"));
dc.logout(); dc.logout();