Added logout and a small fix
This commit is contained in:
parent
bd51083568
commit
4db7bb7082
1 changed files with 7 additions and 2 deletions
|
@ -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;
|
||||||
|
@ -118,7 +123,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
||||||
lastannouncementtime = date;
|
lastannouncementtime = date;
|
||||||
File file = new File("TBMC", "DiscordRedditLastAnnouncement.txt");
|
File file = new File("TBMC", "DiscordRedditLastAnnouncement.txt");
|
||||||
Files.write(lastannouncementtime + "", file, StandardCharsets.UTF_8);
|
Files.write(lastannouncementtime + "", file, StandardCharsets.UTF_8);
|
||||||
channel.sendMessage(msgsb.toString()); //TODO: Mod msgsb for announcements
|
channel.sendMessage(msgsb.toString()); // TODO: Mod msgsb for announcements
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Thread.sleep(10000);
|
Thread.sleep(10000);
|
||||||
|
|
Loading…
Reference in a new issue