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