use of org.javacord.api.event.server.member.ServerMemberLeaveEvent in project Javacord by BtoBastian.
the class GuildMemberRemoveHandler method handle.
@Override
public void handle(JsonNode packet) {
api.getPossiblyUnreadyServerById(packet.get("guild_id").asLong()).map(server -> (ServerImpl) server).ifPresent(server -> {
User user = new UserImpl(api, packet.get("user"), (MemberImpl) null, server);
server.removeMember(user.getId());
server.decrementMemberCount();
ServerMemberLeaveEvent event = new ServerMemberLeaveEventImpl(server, user);
api.getEventDispatcher().dispatchServerMemberLeaveEvent(server, server, user, event);
});
}
Aggregations