diff --git a/src/test/java/tools/helptranslation/HelpTranslationVerifier.java b/src/test/java/tools/helptranslation/HelpTranslationVerifier.java index 2ed130fa0..9cbf12b5c 100644 --- a/src/test/java/tools/helptranslation/HelpTranslationVerifier.java +++ b/src/test/java/tools/helptranslation/HelpTranslationVerifier.java @@ -55,11 +55,15 @@ public class HelpTranslationVerifier { } public List getMissingCommands() { - return missingCommands; + // All entries start with "command.", so remove that + return missingCommands.stream() + .map(s -> s.substring(9)).collect(Collectors.toList()); } public List getUnknownCommands() { - return unknownCommands; + // All entries start with "command.", so remove that + return unknownCommands.stream() + .map(s -> s.substring(9)).collect(Collectors.toList()); } /** @@ -89,14 +93,14 @@ public class HelpTranslationVerifier { Set commandPaths = buildCommandPaths(); Set existingKeys = getLeafKeys("commands"); if (existingKeys.isEmpty()) { - missingCommands.addAll(commandPaths); + missingCommands.addAll(commandPaths); // commandPaths should be empty in this case } else { missingCommands.addAll(Sets.difference(commandPaths, existingKeys)); unknownCommands.addAll(Sets.difference(existingKeys, commandPaths)); } } - private static Set buildCommandPaths() { + private Set buildCommandPaths() { Set commandPaths = new LinkedHashSet<>(); for (CommandDescription command : new CommandInitializer().getCommands()) { commandPaths.addAll(getYamlPaths(command)); @@ -105,11 +109,16 @@ public class HelpTranslationVerifier { return commandPaths; } - private static List getYamlPaths(CommandDescription command) { + private List getYamlPaths(CommandDescription command) { // e.g. commands.authme.register String commandPath = "commands." + CommandUtils.constructParentList(command).stream() .map(cmd -> cmd.getLabels().get(0)) .collect(Collectors.joining(".")); + // The entire command is not present, so just add it as a missing command and don't return any YAML path + if (!configuration.contains(commandPath)) { + missingCommands.add(commandPath); + return Collections.emptyList(); + } // Entries each command can have List paths = newArrayList(commandPath + ".description", commandPath + ".detailedDescription");