Forgot to also pass MRE into ICommandExecutor.

keep-around/d31701866686f66088b78de2e29736ae36e55a68
Pingex aka Raphaël 9 years ago
parent f5fbd49b12
commit 519af58989

@ -1,5 +1,6 @@
package net.pingex.dcf.commands; package net.pingex.dcf.commands;
import sx.blah.discord.handle.impl.events.MessageReceivedEvent;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -142,9 +143,9 @@ public abstract class Command implements ICommandExecutor
return new Command(name, aliases, description, isEnabled, usage) return new Command(name, aliases, description, isEnabled, usage)
{ {
@Override @Override
public void execute(List<String> arguments) throws Throwable public void execute(MessageReceivedEvent event, List<String> arguments) throws Throwable
{ {
toExecute.execute(arguments); toExecute.execute(event, arguments);
} }
}; };
} }
@ -157,7 +158,14 @@ public abstract class Command implements ICommandExecutor
*/ */
public Command build(Method target, Object invokable) public Command build(Method target, Object invokable)
{ {
return build(arguments -> target.invoke(invokable)); return new Command(name, aliases, description, isEnabled, usage)
{
@Override
public void execute(MessageReceivedEvent event, List<String> arguments) throws Throwable
{
target.invoke(invokable, event, arguments);
}
};
} }
} }

@ -1,5 +1,6 @@
package net.pingex.dcf.commands; package net.pingex.dcf.commands;
import sx.blah.discord.handle.impl.events.MessageReceivedEvent;
import java.util.List; import java.util.List;
/** /**
@ -8,5 +9,5 @@ import java.util.List;
@FunctionalInterface @FunctionalInterface
public interface ICommandExecutor public interface ICommandExecutor
{ {
void execute(List<String> arguments) throws Throwable; void execute(MessageReceivedEvent event, List<String> arguments) throws Throwable;
} }