Search in sources :

Example 1 with RoleCreateEventImpl

use of org.javacord.core.event.server.role.RoleCreateEventImpl in project Javacord by BtoBastian.

the class GuildRoleCreateHandler method handle.

@Override
public void handle(JsonNode packet) {
    long serverId = Long.parseLong(packet.get("guild_id").asText());
    api.getPossiblyUnreadyServerById(serverId).ifPresent(server -> {
        Role role = ((ServerImpl) server).getOrCreateRole(packet.get("role"));
        RoleCreateEvent event = new RoleCreateEventImpl(role);
        api.getEventDispatcher().dispatchRoleCreateEvent((DispatchQueueSelector) server, server, event);
    });
}
Also used : Role(org.javacord.api.entity.permission.Role) ServerImpl(org.javacord.core.entity.server.ServerImpl) RoleCreateEvent(org.javacord.api.event.server.role.RoleCreateEvent) RoleCreateEventImpl(org.javacord.core.event.server.role.RoleCreateEventImpl)

Aggregations

Role (org.javacord.api.entity.permission.Role)1 RoleCreateEvent (org.javacord.api.event.server.role.RoleCreateEvent)1 ServerImpl (org.javacord.core.entity.server.ServerImpl)1 RoleCreateEventImpl (org.javacord.core.event.server.role.RoleCreateEventImpl)1