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