Esempio n. 1
0
 @Override
 public List<PermissionOverride> getPermissionOverrides() {
   List<PermissionOverride> overrides = new LinkedList<>();
   overrides.addAll(userPermissionOverrides.values());
   overrides.addAll(rolePermissionOverrides.values());
   return Collections.unmodifiableList(overrides);
 }
Esempio n. 2
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);
     }
   }
 }
Esempio n. 3
0
 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();
   }
 }
Esempio n. 4
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;
    }
Esempio n. 5
0
 @Override
 public List<PermissionOverride> getRolePermissionOverrides() {
   return Collections.unmodifiableList(
       new LinkedList<PermissionOverride>(rolePermissionOverrides.values()));
 }
Esempio n. 6
0
 @Override
 public PermissionOverride getOverrideForRole(Role role) {
   return rolePermissionOverrides.get(role);
 }
Esempio n. 7
0
 @Override
 public PermissionOverride getOverrideForUser(User user) {
   return userPermissionOverrides.get(user);
 }