use of de.btobastian.javacord.listener.role.RoleCreateListener in project Javacord by BtoBastian.
the class GuildRoleCreateHandler method handle.
@Override
public void handle(JSONObject packet) {
String guildId = packet.getString("guild_id");
JSONObject roleJson = packet.getJSONObject("role");
Server server = api.getServerById(guildId);
final Role role = new ImplRole(roleJson, (ImplServer) server, api);
listenerExecutorService.submit(new Runnable() {
@Override
public void run() {
List<RoleCreateListener> listeners = api.getListeners(RoleCreateListener.class);
synchronized (listeners) {
for (RoleCreateListener listener : listeners) {
try {
listener.onRoleCreate(api, role);
} catch (Throwable t) {
logger.warn("Uncaught exception in RoleCreateListener!", t);
}
}
}
}
});
}
Aggregations