Search in sources :

Example 1 with ServerJoinEvent

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

the class GuildCreateHandler method handle.

@Override
public void handle(JsonNode packet) {
    if (packet.has("unavailable") && packet.get("unavailable").asBoolean()) {
        return;
    }
    long id = packet.get("id").asLong();
    if (api.getUnavailableServers().contains(id)) {
        ServerImpl server = new ServerImpl(api, packet);
        ServerBecomesAvailableEvent event = new ServerBecomesAvailableEventImpl(server);
        api.getEventDispatcher().dispatchServerBecomesAvailableEvent(server, event);
        return;
    }
    ServerImpl server = new ServerImpl(api, packet);
    ServerJoinEvent event = new ServerJoinEventImpl(server);
    api.getEventDispatcher().dispatchServerJoinEvent(server, event);
}
Also used : ServerBecomesAvailableEvent(org.javacord.api.event.server.ServerBecomesAvailableEvent) ServerBecomesAvailableEventImpl(org.javacord.core.event.server.ServerBecomesAvailableEventImpl) ServerJoinEvent(org.javacord.api.event.server.ServerJoinEvent) ServerImpl(org.javacord.core.entity.server.ServerImpl) ServerJoinEventImpl(org.javacord.core.event.server.ServerJoinEventImpl)

Aggregations

ServerBecomesAvailableEvent (org.javacord.api.event.server.ServerBecomesAvailableEvent)1 ServerJoinEvent (org.javacord.api.event.server.ServerJoinEvent)1 ServerImpl (org.javacord.core.entity.server.ServerImpl)1 ServerBecomesAvailableEventImpl (org.javacord.core.event.server.ServerBecomesAvailableEventImpl)1 ServerJoinEventImpl (org.javacord.core.event.server.ServerJoinEventImpl)1