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