Example #1
0
 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);
     }
   }
 }
Example #2
0
    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;
    }
Example #3
0
 @Override
 public PermissionOverride getOverrideForRole(Role role) {
   return rolePermissionOverrides.get(role);
 }
Example #4
0
 @Override
 public PermissionOverride getOverrideForUser(User user) {
   return userPermissionOverrides.get(user);
 }