Class GenericScheduledEventUpdateEvent<T>

All Implemented Interfaces:
GenericEvent, UpdateEvent<ScheduledEvent,T>
Direct Known Subclasses:
ScheduledEventUpdateDescriptionEvent, ScheduledEventUpdateEndTimeEvent, ScheduledEventUpdateImageEvent, ScheduledEventUpdateLocationEvent, ScheduledEventUpdateNameEvent, ScheduledEventUpdateStartTimeEvent, ScheduledEventUpdateStatusEvent

public abstract class GenericScheduledEventUpdateEvent<T> extends GenericScheduledEventGatewayEvent implements UpdateEvent<ScheduledEvent,T>
A generic gateway event class representing an update of a ScheduledEvent entity.
All events in net.dv8tion.jda.api.events.guild.scheduledevent.update package extend this event and are fired when a specified field in a ScheduledEvent is updated.

It should be noted that ScheduledEvents are not actual gateway events found in the net.dv8tion.jda.api.events package, but are rather entities similar to User or TextChannel objects representing a scheduled event.

Requirements

These events require the SCHEDULED_EVENTS intent and CacheFlag.SCHEDULED_EVENTS to be enabled.
createDefault(String) and createLight(String) disable this by default!

Discord does not specifically tell us about the updates, but merely tells us the ScheduledEvent was updated and gives us the updated ScheduledEvent object. In order to fire a specific event like this we need to have the old ScheduledEvent cached to compare against.

  • Constructor Details

  • Method Details

    • getEntity

      @Nonnull public ScheduledEvent getEntity()
      Description copied from interface: UpdateEvent
      The affected entity
      Specified by:
      getEntity in interface UpdateEvent<ScheduledEvent,T>
      Returns:
      The affected entity
    • getPropertyIdentifier

      @Nonnull public String getPropertyIdentifier()
      Description copied from interface: UpdateEvent
      The field name for the updated property

      Example

      
       @Override
       public void onGenericRoleUpdate(GenericRoleUpdateEvent event)
       {
           switch (event.getPropertyIdentifier())
           {
           case RoleUpdateColorEvent.IDENTIFIER:
               System.out.printf("Updated color for role: %s%n", event);
               break;
           case RoleUpdatePositionEvent.IDENTIFIER:
               RoleUpdatePositionEvent update = (RoleUpdatePositionEvent) event;
               System.out.printf("Updated position for role: %s raw(%s->%s)%n", event, update.getOldPositionRaw(), update.getNewPositionRaw());
               break;
           default: return;
           }
       }
       
      Specified by:
      getPropertyIdentifier in interface UpdateEvent<ScheduledEvent,T>
      Returns:
      The name of the updated property
    • getOldValue

      @Nullable public T getOldValue()
      Description copied from interface: UpdateEvent
      The old value
      Specified by:
      getOldValue in interface UpdateEvent<ScheduledEvent,T>
      Returns:
      The old value
    • getNewValue

      @Nullable public T getNewValue()
      Description copied from interface: UpdateEvent
      The new value
      Specified by:
      getNewValue in interface UpdateEvent<ScheduledEvent,T>
      Returns:
      The new value
    • toString

      public String toString()
      Overrides:
      toString in class Event