use of fr.xephi.authme.command.CommandDescription in project AuthMeReloaded by AuthMe.
the class CommandPageCreater method addCommandsInfo.
private static void addCommandsInfo(NestedTagValue commandTags, Collection<CommandDescription> commands) {
for (CommandDescription command : commands) {
TagValueHolder tags = TagValueHolder.create().put("command", CommandUtils.constructCommandPath(command)).put("description", command.getDetailedDescription()).put("arguments", formatArguments(command.getArguments())).put("permissions", formatPermissions(command.getPermission()));
commandTags.add(tags);
if (!command.getChildren().isEmpty()) {
addCommandsInfo(commandTags, command.getChildren());
}
}
}
use of fr.xephi.authme.command.CommandDescription in project AuthMeReloaded by AuthMe.
the class GeneratePluginYml method generateCommands.
private static Map<String, Object> generateCommands() {
Collection<CommandDescription> commands = new CommandInitializer().getCommands();
Map<String, Object> entries = new LinkedHashMap<>();
for (CommandDescription command : commands) {
entries.put(command.getLabels().get(0), buildCommandEntry(command));
}
return entries;
}
use of fr.xephi.authme.command.CommandDescription in project AuthMeReloaded by AuthMe.
the class HelpTranslationVerifier method buildCommandPaths.
private Set<String> buildCommandPaths() {
Set<String> commandPaths = new LinkedHashSet<>();
for (CommandDescription command : new CommandInitializer().getCommands()) {
commandPaths.addAll(getYamlPaths(command));
command.getChildren().forEach(child -> commandPaths.addAll(getYamlPaths(child)));
}
return commandPaths;
}
use of fr.xephi.authme.command.CommandDescription in project AuthMeReloaded by AuthMe.
the class HelpMessagesConsistencyTest method shouldHaveIdenticalTexts.
@Test
public void shouldHaveIdenticalTexts() {
// given
CommandDescription description = getAuthMeRegisterDescription();
FileConfiguration configuration = YamlConfiguration.loadConfiguration(DEFAULT_MESSAGES_FILE);
final String path = "commands.authme.register.";
// when / then
assertThat(configuration.get(path + "description"), equalTo(description.getDescription()));
assertThat(configuration.get(path + "detailedDescription"), equalTo(description.getDetailedDescription()));
assertThat(configuration.get(path + "arg1.label"), equalTo(description.getArguments().get(0).getName()));
assertThat(configuration.get(path + "arg1.description"), equalTo(description.getArguments().get(0).getDescription()));
assertThat(configuration.get(path + "arg2.label"), equalTo(description.getArguments().get(1).getName()));
assertThat(configuration.get(path + "arg2.description"), equalTo(description.getArguments().get(1).getDescription()));
}
use of fr.xephi.authme.command.CommandDescription in project AuthMeReloaded by AuthMe.
the class HelpMessagesConsistencyTest method getAuthMeRegisterDescription.
/**
* @return the CommandDescription object for the {@code /authme register} command.
*/
private static CommandDescription getAuthMeRegisterDescription() {
Collection<CommandDescription> commands = new CommandInitializer().getCommands();
List<CommandDescription> children = commands.stream().filter(command -> command.getLabels().contains("authme")).map(CommandDescription::getChildren).findFirst().get();
return children.stream().filter(child -> child.getLabels().contains("register")).findFirst().get();
}
Aggregations