Skip to content

Commit

Permalink
Fire UnavailableGuildJoinedEvent again
Browse files Browse the repository at this point in the history
  • Loading branch information
MinnDevelopment committed Sep 20, 2018
1 parent 3590acf commit 0de9206
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/java/net/dv8tion/jda/core/handle/GuildSetupNode.java
Expand Up @@ -29,6 +29,7 @@
import net.dv8tion.jda.core.entities.impl.JDAImpl;
import net.dv8tion.jda.core.events.guild.GuildJoinEvent;
import net.dv8tion.jda.core.events.guild.GuildReadyEvent;
import net.dv8tion.jda.core.events.guild.UnavailableGuildJoinedEvent;
import net.dv8tion.jda.core.managers.AudioManager;
import net.dv8tion.jda.core.managers.impl.AudioManagerImpl;
import net.dv8tion.jda.core.utils.Helpers;
Expand All @@ -55,6 +56,7 @@ public class GuildSetupNode

final boolean join;
final boolean sync;
boolean firedUnavailableJoin = false;
boolean markedUnavailable = false;
GuildSetupController.Status status = GuildSetupController.Status.INIT;

Expand Down Expand Up @@ -219,7 +221,15 @@ void handleCreate(JSONObject obj)
boolean wasMarkedUnavailable = this.markedUnavailable;
this.markedUnavailable = unavailable;
if (unavailable)
{
if (!firedUnavailableJoin && join)
{
firedUnavailableJoin = true;
JDAImpl api = getController().getJDA();
api.getEventManager().handle(new UnavailableGuildJoinedEvent(api, api.getResponseTotal(), id));
}
return;
}
if (wasMarkedUnavailable && sync && !requestedSync)
{
// We are using a client-account and joined a guild
Expand Down

0 comments on commit 0de9206

Please sign in to comment.