Class Event

java.lang.Object
net.dv8tion.jda.api.events.Event
All Implemented Interfaces:
GenericEvent
Direct Known Subclasses:
AutoModExecutionEvent, ExceptionEvent, GatewayPingEvent, GenericAutoModRuleEvent, GenericChannelEvent, GenericEmojiEvent, GenericForumTagEvent, GenericGuildEvent, GenericGuildStickerEvent, GenericInteractionCreateEvent, GenericMessageEvent, GenericRoleEvent, GenericSelfUpdateEvent, GenericSessionEvent, GenericThreadEvent, GenericUserEvent, GuildTimeoutEvent, HttpRequestEvent, MessageBulkDeleteEvent, RawGatewayEvent, StatusChangeEvent, UnavailableGuildJoinedEvent, UnavailableGuildLeaveEvent

public abstract class Event extends Object implements GenericEvent
Top-level event type
All events JDA fires are derived from this class.

Can be used to check if an Object is a JDA event in EventListener implementations to distinguish what event is being fired.
Adapter implementation: ListenerAdapter

  • Constructor Details

    • Event

      public Event(@Nonnull JDA api, long responseNumber)
      Creates a new Event from the given JDA instance
      Parameters:
      api - Current JDA instance
      responseNumber - The sequence number for this event
      See Also:
    • Event

      public Event(@Nonnull JDA api)
      Creates a new Event from the given JDA instance
      Uses the current JDA.getResponseTotal() as sequence
      Parameters:
      api - Current JDA instance
  • Method Details

    • getJDA

      @Nonnull public JDA getJDA()
      Description copied from interface: GenericEvent
      The current JDA instance corresponding to this Event
      Specified by:
      getJDA in interface GenericEvent
      Returns:
      The corresponding JDA instance
    • getResponseNumber

      public long getResponseNumber()
      Description copied from interface: GenericEvent
      The current sequence for this event.
      This can be used to keep events in order when making sequencing system.
      Specified by:
      getResponseNumber in interface GenericEvent
      Returns:
      The current sequence number for this event
    • getRawData

      @Nullable public DataObject getRawData()
      Description copied from interface: GenericEvent
      The passthrough data that this event was serialized from. This data might be null in rare situations, for example, if the event came from a rest action.
      This provides the full gateway message payload, including sequence, event name and dispatch type. For details, read the official Discord Documentation.
      Specified by:
      getRawData in interface GenericEvent
      Returns:
      The corresponding DataObject
    • toString

      public String toString()
      Overrides:
      toString in class Object