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