@Override public List<PermissionOverride> getPermissionOverrides() { List<PermissionOverride> overrides = new LinkedList<>(); overrides.addAll(userPermissionOverrides.values()); overrides.addAll(rolePermissionOverrides.values()); return Collections.unmodifiableList(overrides); }
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(); } }
public static AsyncMessageSender getInstance(JDA api, String ratelimitIdentifier) { Map<String, AsyncMessageSender> senders = instances.get(api); if (senders == null) { senders = new HashMap<>(); instances.put(api, senders); } AsyncMessageSender sender = senders.get(ratelimitIdentifier); if (sender == null) { sender = new AsyncMessageSender(((JDAImpl) api), ratelimitIdentifier); senders.put(ratelimitIdentifier, sender); } return sender; }
@Override public List<PermissionOverride> getRolePermissionOverrides() { return Collections.unmodifiableList( new LinkedList<PermissionOverride>(rolePermissionOverrides.values())); }
@Override public PermissionOverride getOverrideForRole(Role role) { return rolePermissionOverrides.get(role); }
@Override public PermissionOverride getOverrideForUser(User user) { return userPermissionOverrides.get(user); }