Search in sources :

Example 1 with UserChangeActivityEvent

use of org.javacord.api.event.user.UserChangeActivityEvent in project Javacord by BtoBastian.

the class PresenceUpdateHandler method dispatchUserActivityChangeEvent.

private void dispatchUserActivityChangeEvent(long userId, Set<Activity> newActivities, Set<Activity> oldActivities) {
    UserImpl user = api.getCachedUserById(userId).map(UserImpl.class::cast).orElse(null);
    UserChangeActivityEvent event = new UserChangeActivityEventImpl(api, userId, newActivities, oldActivities);
    api.getEventDispatcher().dispatchUserChangeActivityEvent(api, user == null ? Collections.emptySet() : user.getMutualServers(), user == null ? Collections.emptySet() : Collections.singleton(user), event);
}
Also used : UserChangeActivityEvent(org.javacord.api.event.user.UserChangeActivityEvent) UserImpl(org.javacord.core.entity.user.UserImpl) UserChangeActivityEventImpl(org.javacord.core.event.user.UserChangeActivityEventImpl)

Aggregations

UserChangeActivityEvent (org.javacord.api.event.user.UserChangeActivityEvent)1 UserImpl (org.javacord.core.entity.user.UserImpl)1 UserChangeActivityEventImpl (org.javacord.core.event.user.UserChangeActivityEventImpl)1