Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #232 from BigBotNetwork/greg-dev
Browse files Browse the repository at this point in the history
Merged!
  • Loading branch information
greg6775 authored Dec 21, 2019
2 parents ec46776 + d482639 commit 54e47fc
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>Hadder</groupId>
<artifactId>Hadder</artifactId>
<version>0.10-ALPHA</version>
<version>0.1-BETA</version>

<name>Hadder</name>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.bbn.hadder.core.Perm;
import com.bbn.hadder.core.Perms;
import com.bbn.hadder.utils.MessageEditor;
import net.dv8tion.jda.api.Permission;

@Perms(Perm.MANAGE_SERVER)
public class InviteDetectCommand implements Command {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.bbn.hadder.core.Perm;
import com.bbn.hadder.core.Perms;
import com.bbn.hadder.utils.MessageEditor;
import net.dv8tion.jda.api.Permission;

@Perms(Perm.MANAGE_SERVER)
public class PrefixCommand implements Command {
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/bbn/hadder/commands/owner/TestCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.core.Perm;
import com.bbn.hadder.core.Perms;
import com.bbn.hadder.utils.MessageEditor.MessageType;

/*
Expand Down
16 changes: 7 additions & 9 deletions src/main/java/com/bbn/hadder/core/CommandHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@ public void handle(MessageReceivedEvent event, Rethink rethink, String prefix) {

CommandEvent commandEvent = new CommandEvent(event.getJDA(), event.getResponseNumber(), event.getMessage(), rethink,
config, this, helpCommand, new MessageEditor(rethink, event.getAuthor()));
if (cmd.getClass().getAnnotations().length>0) {
if (!Arrays.asList(cmd.getClass().getAnnotations()).contains(Perms.class)) {
for (Perm perm : cmd.getClass().getAnnotation(Perms.class).value()) {
if (!perm.check(commandEvent)) {
commandEvent.getTextChannel()
.sendMessage(commandEvent.getMessageEditor().getMessage(MessageEditor.MessageType.NO_PERMISSION).build())
.queue();
return;
}
if (cmd.getClass().getAnnotations().length > 0 && !Arrays.asList(cmd.getClass().getAnnotations()).contains(Perms.class)) {
for (Perm perm : cmd.getClass().getAnnotation(Perms.class).value()) {
if (!perm.check(commandEvent)) {
commandEvent.getTextChannel()
.sendMessage(commandEvent.getMessageEditor().getMessage(MessageEditor.MessageType.NO_PERMISSION).build())
.queue();
return;
}
}
}
Expand Down

0 comments on commit 54e47fc

Please sign in to comment.