mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-01-05 23:08:23 +00:00
Ensure JDA is started before allowing calls to the JDA object
This commit is contained in:
parent
51c49b0de6
commit
668c9634ca
1 changed files with 2 additions and 1 deletions
|
@ -149,9 +149,9 @@ public class JDADiscordService implements DiscordService, IEssentialsModule {
|
||||||
public void startup() throws LoginException, InterruptedException {
|
public void startup() throws LoginException, InterruptedException {
|
||||||
shutdown();
|
shutdown();
|
||||||
|
|
||||||
|
invalidStartup = true;
|
||||||
logger.log(Level.INFO, tl("discordLoggingIn"));
|
logger.log(Level.INFO, tl("discordLoggingIn"));
|
||||||
if (plugin.getSettings().getBotToken().replace("INSERT-TOKEN-HERE", "").trim().isEmpty()) {
|
if (plugin.getSettings().getBotToken().replace("INSERT-TOKEN-HERE", "").trim().isEmpty()) {
|
||||||
invalidStartup = true;
|
|
||||||
throw new IllegalArgumentException(tl("discordErrorNoToken"));
|
throw new IllegalArgumentException(tl("discordErrorNoToken"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,6 +162,7 @@ public class JDADiscordService implements DiscordService, IEssentialsModule {
|
||||||
.setContextEnabled(false)
|
.setContextEnabled(false)
|
||||||
.build()
|
.build()
|
||||||
.awaitReady();
|
.awaitReady();
|
||||||
|
invalidStartup = false;
|
||||||
updatePresence();
|
updatePresence();
|
||||||
logger.log(Level.INFO, tl("discordLoggingInDone", jda.getSelfUser().getAsTag()));
|
logger.log(Level.INFO, tl("discordLoggingInDone", jda.getSelfUser().getAsTag()));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue