Search in sources :

Example 1 with ServerStageVoiceChannelImpl

use of org.javacord.core.entity.channel.ServerStageVoiceChannelImpl in project Javacord by BtoBastian.

the class ServerImpl method getOrCreateServerStageVoiceChannel.

/**
 * Gets or creates a server stage voice channel.
 *
 * @param data The json data of the channel.
 * @return The server stage voice channel.
 */
public ServerStageVoiceChannel getOrCreateServerStageVoiceChannel(JsonNode data) {
    long id = Long.parseLong(data.get("id").asText());
    ChannelType type = ChannelType.fromId(data.get("type").asInt());
    synchronized (this) {
        if (type == ChannelType.SERVER_STAGE_VOICE_CHANNEL) {
            return getStageVoiceChannelById(id).orElseGet(() -> new ServerStageVoiceChannelImpl(api, this, data));
        }
    }
    // Invalid channel type
    return null;
}
Also used : ServerStageVoiceChannelImpl(org.javacord.core.entity.channel.ServerStageVoiceChannelImpl) ChannelType(org.javacord.api.entity.channel.ChannelType)

Aggregations

ChannelType (org.javacord.api.entity.channel.ChannelType)1 ServerStageVoiceChannelImpl (org.javacord.core.entity.channel.ServerStageVoiceChannelImpl)1