refactor(autocomplete): implement autocompleteRefs and remove SlashCommand annotation on Autocomplete Method
All checks were successful
github-mirror / push-github (push) Successful in 1m41s
Build / Gradle-Build (push) Successful in 34s
Test / Gradle-Test (push) Successful in 48s

This commit is contained in:
2025-03-31 10:36:49 +02:00
parent 92540576df
commit 450f1fdaa1
17 changed files with 186 additions and 56 deletions

View File

@@ -0,0 +1,33 @@
package net.tomatentum.marinara.parser;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.function.Consumer;
import net.tomatentum.marinara.interaction.annotation.AutoComplete;
public class AutocompleteParser implements AnnotationParser {
private Method method;
private Consumer<String[]> consumer;
public AutocompleteParser(Method method, Consumer<String[]> consumer) {
this.method = method;
this.consumer = consumer;
}
@Override
public void parse() {
String[] autocompletes = Arrays.stream(this.method.getAnnotationsByType(AutoComplete.class))
.map(AutoComplete::value)
.toArray(String[]::new);
this.consumer.accept(autocompletes);
}
@Override
public Method getMethod() {
return this.method;
}
}