use of de.btobastian.javacord.listener.server.ServerMemberUnbanListener in project Javacord by BtoBastian.
the class GuildBanRemoveHandler method handle.
@Override
public void handle(JSONObject packet) {
final Server server = api.getServerById(packet.getString("guild_id"));
final User user = api.getOrCreateUser(packet.getJSONObject("user"));
if (server != null) {
((ImplServer) server).removeMember(user);
listenerExecutorService.submit(new Runnable() {
@Override
public void run() {
List<ServerMemberUnbanListener> listeners = api.getListeners(ServerMemberUnbanListener.class);
synchronized (listeners) {
for (ServerMemberUnbanListener listener : listeners) {
try {
listener.onServerMemberUnban(api, user.getId(), server);
} catch (Throwable t) {
logger.warn("Uncaught exception in ServerMemberUnbanListener!", t);
}
}
}
}
});
}
}
Aggregations