public static synchronized void stop(JDA api, String ratelimitIdentifier) { Map<String, AsyncMessageSender> senders = instances.get(api); if (senders != null && !senders.isEmpty()) { AsyncMessageSender sender = senders.get(ratelimitIdentifier); if (sender != null) { sender.kill(); senders.remove(ratelimitIdentifier); } } }
public static synchronized void stopAll(JDA api) { Map<String, AsyncMessageSender> senders = instances.get(api); if (senders != null && !senders.isEmpty()) { senders .values() .forEach( sender -> { sender.kill(); }); senders.clear(); } }