Search in sources :

Example 1 with ServerChannelCreateEvent

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

the class ChannelCreateHandler method handleServerVoiceChannel.

/**
 * Handles server voice channel creation.
 *
 * @param channel The channel data.
 */
private void handleServerVoiceChannel(JsonNode channel) {
    long serverId = channel.get("guild_id").asLong();
    api.getPossiblyUnreadyServerById(serverId).ifPresent(server -> {
        ServerVoiceChannel voiceChannel = ((ServerImpl) server).getOrCreateServerVoiceChannel(channel);
        ServerChannelCreateEvent event = new ServerChannelCreateEventImpl(voiceChannel);
        api.getEventDispatcher().dispatchServerChannelCreateEvent((DispatchQueueSelector) server, server, event);
    });
}
Also used : ServerImpl(org.javacord.core.entity.server.ServerImpl) ServerChannelCreateEvent(org.javacord.api.event.channel.server.ServerChannelCreateEvent) ServerVoiceChannel(org.javacord.api.entity.channel.ServerVoiceChannel) ServerChannelCreateEventImpl(org.javacord.core.event.channel.server.ServerChannelCreateEventImpl)

Example 2 with ServerChannelCreateEvent

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

the class ChannelCreateHandler method handleChannelCategory.

/**
 * Handles channel category creation.
 *
 * @param channel The channel data.
 */
private void handleChannelCategory(JsonNode channel) {
    long serverId = channel.get("guild_id").asLong();
    api.getPossiblyUnreadyServerById(serverId).ifPresent(server -> {
        ChannelCategory channelCategory = ((ServerImpl) server).getOrCreateChannelCategory(channel);
        ServerChannelCreateEvent event = new ServerChannelCreateEventImpl(channelCategory);
        api.getEventDispatcher().dispatchServerChannelCreateEvent((DispatchQueueSelector) server, server, event);
    });
}
Also used : ServerImpl(org.javacord.core.entity.server.ServerImpl) ServerChannelCreateEvent(org.javacord.api.event.channel.server.ServerChannelCreateEvent) ChannelCategory(org.javacord.api.entity.channel.ChannelCategory) ServerChannelCreateEventImpl(org.javacord.core.event.channel.server.ServerChannelCreateEventImpl)

Example 3 with ServerChannelCreateEvent

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

the class ChannelCreateHandler method handleServerTextChannel.

/**
 * Handles server text channel creation.
 *
 * @param channel The channel data.
 */
private void handleServerTextChannel(JsonNode channel) {
    long serverId = channel.get("guild_id").asLong();
    api.getPossiblyUnreadyServerById(serverId).ifPresent(server -> {
        ServerTextChannel textChannel = ((ServerImpl) server).getOrCreateServerTextChannel(channel);
        ServerChannelCreateEvent event = new ServerChannelCreateEventImpl(textChannel);
        api.getEventDispatcher().dispatchServerChannelCreateEvent((DispatchQueueSelector) server, server, event);
    });
}
Also used : ServerTextChannel(org.javacord.api.entity.channel.ServerTextChannel) ServerImpl(org.javacord.core.entity.server.ServerImpl) ServerChannelCreateEvent(org.javacord.api.event.channel.server.ServerChannelCreateEvent) ServerChannelCreateEventImpl(org.javacord.core.event.channel.server.ServerChannelCreateEventImpl)

Example 4 with ServerChannelCreateEvent

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

the class ChannelCreateHandler method handleServerStageVoiceChannel.

/**
 * Handles server stage voice channel creation.
 *
 * @param channel The channel data.
 */
private void handleServerStageVoiceChannel(JsonNode channel) {
    long serverId = channel.get("guild_id").asLong();
    api.getPossiblyUnreadyServerById(serverId).ifPresent(server -> {
        ServerStageVoiceChannel voiceChannel = ((ServerImpl) server).getOrCreateServerStageVoiceChannel(channel);
        ServerChannelCreateEvent event = new ServerChannelCreateEventImpl(voiceChannel);
        api.getEventDispatcher().dispatchServerChannelCreateEvent((DispatchQueueSelector) server, server, event);
    });
}
Also used : ServerImpl(org.javacord.core.entity.server.ServerImpl) ServerChannelCreateEvent(org.javacord.api.event.channel.server.ServerChannelCreateEvent) ServerStageVoiceChannel(org.javacord.api.entity.channel.ServerStageVoiceChannel) ServerChannelCreateEventImpl(org.javacord.core.event.channel.server.ServerChannelCreateEventImpl)

Aggregations

ServerChannelCreateEvent (org.javacord.api.event.channel.server.ServerChannelCreateEvent)4 ServerImpl (org.javacord.core.entity.server.ServerImpl)4 ServerChannelCreateEventImpl (org.javacord.core.event.channel.server.ServerChannelCreateEventImpl)4 ChannelCategory (org.javacord.api.entity.channel.ChannelCategory)1 ServerStageVoiceChannel (org.javacord.api.entity.channel.ServerStageVoiceChannel)1 ServerTextChannel (org.javacord.api.entity.channel.ServerTextChannel)1 ServerVoiceChannel (org.javacord.api.entity.channel.ServerVoiceChannel)1