Search in sources :

Example 1 with ServerMembersChunkEventImpl

use of org.javacord.core.event.server.member.ServerMembersChunkEventImpl in project Javacord by BtoBastian.

the class GuildMembersChunkHandler method handle.

@Override
public void handle(JsonNode packet) {
    api.getPossiblyUnreadyServerById(packet.get("guild_id").asLong()).map(ServerImpl.class::cast).ifPresent(server -> {
        List<Member> members = server.addAndGetMembers(packet.get("members"));
        ServerMembersChunkEventImpl event = new ServerMembersChunkEventImpl(server, members.stream().map(Member::getUser).collect(Collectors.toList()));
        api.getEventDispatcher().dispatchServerMembersChunkEvent(server, server, event);
    });
}
Also used : ServerMembersChunkEventImpl(org.javacord.core.event.server.member.ServerMembersChunkEventImpl) Member(org.javacord.core.entity.user.Member)

Aggregations

Member (org.javacord.core.entity.user.Member)1 ServerMembersChunkEventImpl (org.javacord.core.event.server.member.ServerMembersChunkEventImpl)1