Search in sources :

Example 1 with ServerMemberUnbanEvent

use of org.javacord.api.event.server.member.ServerMemberUnbanEvent in project Javacord by BtoBastian.

the class GuildBanRemoveHandler 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);
        ServerMemberUnbanEvent event = new ServerMemberUnbanEventImpl(server, user);
        api.getEventDispatcher().dispatchServerMemberUnbanEvent(server, server, user, event);
    });
}
Also used : ServerImpl(org.javacord.core.entity.server.ServerImpl) ServerMemberUnbanEventImpl(org.javacord.core.event.server.member.ServerMemberUnbanEventImpl) User(org.javacord.api.entity.user.User) PacketHandler(org.javacord.core.util.gateway.PacketHandler) DiscordApi(org.javacord.api.DiscordApi) UserImpl(org.javacord.core.entity.user.UserImpl) MemberImpl(org.javacord.core.entity.user.MemberImpl) JsonNode(com.fasterxml.jackson.databind.JsonNode) ServerMemberUnbanEvent(org.javacord.api.event.server.member.ServerMemberUnbanEvent) ServerMemberUnbanEventImpl(org.javacord.core.event.server.member.ServerMemberUnbanEventImpl) User(org.javacord.api.entity.user.User) ServerImpl(org.javacord.core.entity.server.ServerImpl) UserImpl(org.javacord.core.entity.user.UserImpl) ServerMemberUnbanEvent(org.javacord.api.event.server.member.ServerMemberUnbanEvent)

Aggregations

JsonNode (com.fasterxml.jackson.databind.JsonNode)1 DiscordApi (org.javacord.api.DiscordApi)1 User (org.javacord.api.entity.user.User)1 ServerMemberUnbanEvent (org.javacord.api.event.server.member.ServerMemberUnbanEvent)1 ServerImpl (org.javacord.core.entity.server.ServerImpl)1 MemberImpl (org.javacord.core.entity.user.MemberImpl)1 UserImpl (org.javacord.core.entity.user.UserImpl)1 ServerMemberUnbanEventImpl (org.javacord.core.event.server.member.ServerMemberUnbanEventImpl)1 PacketHandler (org.javacord.core.util.gateway.PacketHandler)1