Skip to content

Commit

Permalink
Update event hierarchy (#1952)
Browse files Browse the repository at this point in the history
* Add abstraction for session state events
* Remove Voice Move/Join/Leave events
  • Loading branch information
MinnDevelopment authored Sep 27, 2022
1 parent c139953 commit be1deeb
Show file tree
Hide file tree
Showing 22 changed files with 291 additions and 402 deletions.
3 changes: 2 additions & 1 deletion src/main/java/net/dv8tion/jda/api/JDABuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import net.dv8tion.jda.api.entities.Activity;
import net.dv8tion.jda.api.events.Event;
import net.dv8tion.jda.api.exceptions.InvalidTokenException;
import net.dv8tion.jda.api.events.session.ReadyEvent;
import net.dv8tion.jda.api.hooks.IEventManager;
import net.dv8tion.jda.api.hooks.VoiceDispatchInterceptor;
import net.dv8tion.jda.api.requests.GatewayIntent;
Expand Down Expand Up @@ -1738,7 +1739,7 @@ public JDABuilder setMaxBufferSize(int bufferSize)
* <p>If you wish to be sure that the {@link net.dv8tion.jda.api.JDA} information is correct, please use
* {@link net.dv8tion.jda.api.JDA#awaitReady() JDA.awaitReady()} or register an
* {@link net.dv8tion.jda.api.hooks.EventListener EventListener} to listen for the
* {@link net.dv8tion.jda.api.events.ReadyEvent ReadyEvent}.
* {@link ReadyEvent ReadyEvent}.
*
* @throws InvalidTokenException
* If the provided token is invalid.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,26 @@

import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.events.ReadyEvent;
import net.dv8tion.jda.api.events.session.ReadyEvent;
import net.dv8tion.jda.api.events.session.SessionRecreateEvent;

import javax.annotation.Nonnull;

/**
* Indicates that a {@link net.dv8tion.jda.api.entities.Guild Guild} finished setting up
* Indicates that a {@link Guild} finished setting up
* <br>This event is fired if a guild finished setting up during login phase.
* After this event is fired, JDA will start dispatching events related to this guild.
* This indicates a guild was created and added to the cache. It will be fired for both the initial
* setup and full reconnects (indicated by {@link net.dv8tion.jda.api.events.ReconnectedEvent ReconnectedEvent}).
* setup and full reconnects (indicated by {@link SessionRecreateEvent}).
*
* <p>Can be used to initialize any services that depend on this guild.
*
* <p>When a guild fails to ready up due to Discord outages you will not receive this event.
* Guilds that fail to ready up will either timeout or get marked as unavailable.
* <br>You can use {@link ReadyEvent#getGuildUnavailableCount()} and {@link JDA#getUnavailableGuilds()} to check for unavailable guilds.
* {@link GuildTimeoutEvent} will be fired for guilds that don't ready up and also don't get marked as unavailable by Discord.
* Guilds that timeout will be marked as unavailable by the timeout event, they will <b>not</b> fire a {@link GuildUnavailableEvent} as that event is only indicating that a guild becomes unavailable <b>after</b> ready happened.
* Guilds that timeout will be marked as unavailable by the timeout event,
* they will <b>not</b> fire a {@link GuildUnavailableEvent} as that event is only indicating that a guild becomes unavailable <b>after</b> ready happened.
*/
public class GuildReadyEvent extends GenericGuildEvent
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.events.Event;
import net.dv8tion.jda.api.events.ReadyEvent;
import net.dv8tion.jda.api.events.session.ReadyEvent;

import javax.annotation.Nonnull;

/**
* Indicates that a guild failed to ready up and timed out.
* <br>Usually this event will be fired right before a {@link net.dv8tion.jda.api.events.ReadyEvent ReadyEvent}.
* <br>Usually this event will be fired right before a {@link ReadyEvent ReadyEvent}.
*
* <p>This will mark the guild as <b>unavailable</b> and it will not be usable when JDA becomes ready.
* You can check all unavailable guilds with {@link ReadyEvent#getGuildUnavailableCount()} and {@link JDA#getUnavailableGuilds()}.
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit be1deeb

Please sign in to comment.