Greg dev #269
3 changed files with 12 additions and 4 deletions
|
|
@ -4,6 +4,7 @@ import com.bbn.hadder.Rethink;
|
|||
import com.bbn.hadder.commands.general.HelpCommand;
|
||||
import com.bbn.hadder.core.CommandHandler;
|
||||
import com.bbn.hadder.core.Config;
|
||||
import com.bbn.hadder.utils.EventWaiter;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
|
|
@ -18,14 +19,16 @@ public class CommandEvent extends MessageReceivedEvent {
|
|||
private CommandHandler commandHandler;
|
||||
private HelpCommand helpCommand;
|
||||
private MessageEditor messageEditor;
|
||||
private EventWaiter eventWaiter;
|
||||
|
||||
public CommandEvent(@Nonnull JDA api, long responseNumber, @Nonnull Message message, Rethink rethink, Config config, CommandHandler commandHandler, HelpCommand helpCommand, MessageEditor messageEditor) {
|
||||
public CommandEvent(@Nonnull JDA api, long responseNumber, @Nonnull Message message, Rethink rethink, Config config, CommandHandler commandHandler, HelpCommand helpCommand, MessageEditor messageEditor, EventWaiter eventWaiter) {
|
||||
super(api, responseNumber, message);
|
||||
this.rethink = rethink;
|
||||
this.config = config;
|
||||
this.commandHandler = commandHandler;
|
||||
this.helpCommand = helpCommand;
|
||||
this.messageEditor = messageEditor;
|
||||
this.eventWaiter = eventWaiter;
|
||||
}
|
||||
|
||||
public Rethink getRethink() {
|
||||
|
|
@ -47,4 +50,8 @@ public class CommandEvent extends MessageReceivedEvent {
|
|||
public MessageEditor getMessageEditor() {
|
||||
return messageEditor;
|
||||
}
|
||||
|
||||
public EventWaiter getEventWaiter() {
|
||||
return eventWaiter;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ public class EditRulesCommand implements Command {
|
|||
.build()).queue();
|
||||
}
|
||||
}
|
||||
}, event);
|
||||
}, event);
|
||||
}, event.getJDA(), event.getAuthor());
|
||||
}, event.getJDA(), event.getAuthor());
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.editrules.error.title", "",
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.bbn.hadder.Rethink;
|
|||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.commands.general.HelpCommand;
|
||||
import com.bbn.hadder.utils.EventWaiter;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
|
|
@ -34,7 +35,7 @@ public class CommandHandler {
|
|||
if (args.length > 0 && args[0].equals("")) args = new String[0];
|
||||
|
||||
CommandEvent commandEvent = new CommandEvent(event.getJDA(), event.getResponseNumber(), event.getMessage(), rethink,
|
||||
config, this, helpCommand, new MessageEditor(rethink, event.getAuthor()));
|
||||
config, this, helpCommand, new MessageEditor(rethink, event.getAuthor()), new EventWaiter());
|
||||
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)) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue