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;
}
Aggregations