diff --git a/src/main/java/link/locutus/discord/commands/manager/v2/command/CommandGroup.java b/src/main/java/link/locutus/discord/commands/manager/v2/command/CommandGroup.java index 8ab5e7ec..f95551af 100644 --- a/src/main/java/link/locutus/discord/commands/manager/v2/command/CommandGroup.java +++ b/src/main/java/link/locutus/discord/commands/manager/v2/command/CommandGroup.java @@ -382,16 +382,22 @@ private void register(Class clazz, List path, Map, Object> i try { CommandRef ref = (CommandRef) clazz.getDeclaredField("cmd").get(null); - Method create = ref.getClass().getDeclaredMethods()[0]; - for (Parameter parameter : create.getParameters()) { - String name = parameter.getName().toLowerCase(Locale.ROOT); - if (userParamsLower.contains(name)) continue; - // replace camelCase with under_case - String nameUnder = parameter.getName().replaceAll("([a-z])([A-Z])", "$1_$2").toLowerCase(Locale.ROOT); - if (userParamsLower.contains(nameUnder)) continue; - System.out.println("Missing parameter `" + name + "` for " + methodInfo.clazz().getSimpleName() + " | " + methodInfo.method() + " | " + methodInfo.field() + " | " + clazz.getSimpleName() + " | " + callable.getUserParameterMap().keySet()); + Set argsPresent = new LinkedHashSet<>(); + for (Method method : ref.getClass().getDeclaredMethods()) { + if (method.getReturnType().equals(ref.getClass()) && method.getParameterCount() == 1 && method.getParameterTypes()[0].equals(String.class)) { + argsPresent.add(method.getName().toLowerCase(Locale.ROOT)); + } + } + for (String arg : userParamsLower) { + if (!argsPresent.contains(arg)) { + System.out.println("Missing method for " + methodInfo.clazz().getSimpleName() + " | " + methodInfo.method() + " | " + methodInfo.field() + " | " + clazz.getSimpleName() + " | " + arg); + } + } + for (String arg : argsPresent) { + if (!userParamsLower.contains(arg)) { + System.out.println("Missing parameter (2) for " + methodInfo.clazz().getSimpleName() + " | " + methodInfo.method() + " | " + methodInfo.field() + " | " + clazz.getSimpleName() + " | " + arg); + } } - } catch (IllegalAccessException | NoSuchFieldException e) { throw new RuntimeException(e); } diff --git a/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/refs/CM.java b/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/refs/CM.java index 97f177c5..9fae563a 100644 --- a/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/refs/CM.java +++ b/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/refs/CM.java @@ -6353,7 +6353,7 @@ public unregister alliance(String value) { } public static class selection_alias{ public static class add{ - @AutoRegister(clazz=link.locutus.discord.commands.manager.v2.impl.pw.filter.AlliancePlaceholders.class,method="addSelectionAlias") + @AutoRegister(clazz=link.locutus.discord.commands.manager.v2.impl.pw.filter.PlaceholdersMap.class,method="addSelectionAlias", field="ALLIANCES") public static class alliance extends CommandRef { public static final alliance cmd = new alliance(); public alliance name(String value) { @@ -6497,7 +6497,7 @@ public militaryunit military_units(String value) { } } - @AutoRegister(clazz=link.locutus.discord.commands.manager.v2.impl.pw.filter.NationPlaceholders.class,method="addSelectionAlias") + @AutoRegister(clazz=link.locutus.discord.commands.manager.v2.impl.pw.filter.PlaceholdersMap.class,method="addSelectionAlias", field="NATIONS") public static class nation extends CommandRef { public static final nation cmd = new nation(); public nation name(String value) { @@ -7883,7 +7883,7 @@ public view sheet(String value) { } public static class sheet_template{ public static class add{ - @AutoRegister(clazz=link.locutus.discord.commands.manager.v2.impl.pw.filter.AlliancePlaceholders.class,method="addColumns") + @AutoRegister(clazz=link.locutus.discord.commands.manager.v2.impl.pw.filter.PlaceholdersMap.class,method="addColumns", field="ALLIANCES") public static class alliance extends CommandRef { public static final alliance cmd = new alliance(); public alliance sheet(String value) { @@ -9131,7 +9131,7 @@ public militaryunit x(String value) { } } - @AutoRegister(clazz=link.locutus.discord.commands.manager.v2.impl.pw.filter.NationPlaceholders.class,method="addColumns") + @AutoRegister(clazz=link.locutus.discord.commands.manager.v2.impl.pw.filter.PlaceholdersMap.class,method="addColumns", field="NATIONS") public static class nation extends CommandRef { public static final nation cmd = new nation(); public nation sheet(String value) {