use of de.btobastian.javacord.listener.voicechannel.VoiceChannelCreateListener in project Javacord by BtoBastian.
the class ChannelCreateHandler method handleServerVoiceChannel.
/**
* Handles the server voice channels.
*
* @param packet The packet (the "d"-object).
* @param server The server of the channel.
*/
private void handleServerVoiceChannel(JSONObject packet, Server server) {
if (server.getVoiceChannelById(packet.getString("id")) != null) {
return;
}
final VoiceChannel channel = new ImplVoiceChannel(packet, (ImplServer) server, api);
listenerExecutorService.submit(new Runnable() {
@Override
public void run() {
List<VoiceChannelCreateListener> listeners = api.getListeners(VoiceChannelCreateListener.class);
synchronized (listeners) {
for (VoiceChannelCreateListener listener : listeners) {
try {
listener.onVoiceChannelCreate(api, channel);
} catch (Throwable t) {
logger.warn("Uncaught exception in VoiceChannelCreateListener!", t);
}
}
}
}
});
}
Aggregations