use of de.btobastian.javacord.listener.voicechannel.VoiceChannelDeleteListener in project Javacord by BtoBastian.
the class ChannelDeleteHandler 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) {
final VoiceChannel channel = server.getVoiceChannelById(packet.getString("id"));
if (channel == null) {
return;
}
((ImplServer) server).removeVoiceChannel(channel);
listenerExecutorService.submit(new Runnable() {
@Override
public void run() {
List<VoiceChannelDeleteListener> listeners = api.getListeners(VoiceChannelDeleteListener.class);
synchronized (listeners) {
for (VoiceChannelDeleteListener listener : listeners) {
try {
listener.onVoiceChannelDelete(api, channel);
} catch (Throwable t) {
logger.warn("Uncaught exception in VoiceChannelDeleteListener!", t);
}
}
}
}
});
}
Aggregations