[AB-246] changing parameter handling to only actually evaluate the necessary parameter handlers, this helps avoiding providing the wrong parameter to the actual command

This commit is contained in:
Sheldan
2021-05-02 17:40:52 +02:00
parent 23dd02312a
commit 2a5c462c35
43 changed files with 210 additions and 92 deletions

View File

@@ -9,7 +9,7 @@ import net.dv8tion.jda.api.entities.Message;
import java.util.concurrent.CompletableFuture;
public interface CommandParameterHandler {
boolean handles(Class clazz);
boolean handles(Class clazz, UnparsedCommandParameterPiece value);
default boolean async() { return false; }
default Object handle(UnparsedCommandParameterPiece input, CommandParameterIterators iterators, Parameter param, Message context, Command command) { return new Object();}
default CompletableFuture<Object> handleAsync(UnparsedCommandParameterPiece input, CommandParameterIterators iterators, Parameter param, Message context, Command command) { return CompletableFuture.completedFuture(null); }