Added logout and a small fix

This commit is contained in:
Norbi Peti 2016-10-08 16:57:54 +02:00
parent bd51083568
commit 4db7bb7082

View file

@ -38,7 +38,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
if (file.exists()) { if (file.exists()) {
BufferedReader reader = Files.newReader(file, StandardCharsets.UTF_8); BufferedReader reader = Files.newReader(file, StandardCharsets.UTF_8);
String line = reader.readLine(); String line = reader.readLine();
lastannouncementtime = Integer.parseInt(line); lastannouncementtime = Long.parseLong(line);
} }
ClientBuilder cb = new ClientBuilder(); ClientBuilder cb = new ClientBuilder();
cb.withToken(IOUtils.toString(getClass().getResourceAsStream("/Token.txt"), Charsets.UTF_8)); cb.withToken(IOUtils.toString(getClass().getResourceAsStream("/Token.txt"), Charsets.UTF_8));
@ -72,6 +72,11 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
@Override @Override
public void onDisable() { public void onDisable() {
stop = true; stop = true;
try {
dc.logout();
} catch (Exception e) {
e.printStackTrace();
}
} }
private long lastannouncementtime = 0; private long lastannouncementtime = 0;