rename to make more sense x2

This commit is contained in:
2024-10-26 00:56:27 +02:00
parent 11ebb3fdea
commit f4a6bf937d
10 changed files with 29 additions and 30 deletions

View File

@@ -3,7 +3,7 @@ package net.tomatentum.marinara.util;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import net.tomatentum.marinara.interaction.commands.annotation.ApplicationCommand;
import net.tomatentum.marinara.interaction.commands.annotation.SlashCommand;
import net.tomatentum.marinara.interaction.commands.annotation.SubCommand;
public final class ReflectionUtil {
@@ -22,16 +22,16 @@ public final class ReflectionUtil {
}
public static void checkValidCommandMethod(Method method) {
if (method.isAnnotationPresent(ApplicationCommand.class) &&
method.getDeclaringClass().isAnnotationPresent(ApplicationCommand.class)) {
if (method.isAnnotationPresent(SlashCommand.class) &&
method.getDeclaringClass().isAnnotationPresent(SlashCommand.class)) {
throw new RuntimeException(method.getName() + ": Can't have ApplicationCommand Annotation on Class and Method");
}
if (!isAnnotationPresent(method, ApplicationCommand.class))
if (!isAnnotationPresent(method, SlashCommand.class))
throw new RuntimeException(method.getName() + ": Missing ApplicationCommand Annotation on either Class or Method");
if (!(method.isAnnotationPresent(SubCommand.class) &&
isAnnotationPresent(method, ApplicationCommand.class))) {
isAnnotationPresent(method, SlashCommand.class))) {
throw new RuntimeException(method.getName() + ": Missing ApplicationCommand Annotation on either Method or Class");
}
}