use of tools.utils.TagValueHolder in project AuthMeReloaded by AuthMe.
the class HashAlgorithmsDescriptionTask method constructMethodRows.
private static NestedTagValue constructMethodRows(Map<HashAlgorithm, MethodDescription> descriptions) {
NestedTagValue methodTags = new NestedTagValue();
for (Map.Entry<HashAlgorithm, MethodDescription> entry : descriptions.entrySet()) {
MethodDescription description = entry.getValue();
TagValueHolder tags = TagValueHolder.create().put("name", asString(entry.getKey())).put("recommendation", asString(description.getUsage())).put("hash_length", asString(description.getHashLength())).put("ascii_restricted", asString(description.isAsciiRestricted())).put("salt_type", asString(description.getSaltType())).put("salt_length", asString(description.getSaltLength())).put("separate_salt", asString(description.hasSeparateSalt()));
methodTags.add(tags);
}
return methodTags;
}
use of tools.utils.TagValueHolder in project AuthMeReloaded by AuthMe.
the class TranslationPageGenerator method executeDefault.
@Override
public void executeDefault() {
TranslationsGatherer gatherer = new TranslationsGatherer();
NestedTagValue translationValuesHolder = new NestedTagValue();
for (TranslationInfo translation : gatherer.getTranslationInfo()) {
int percentage = (int) Math.round(translation.getPercentTranslated() * 100);
String name = Optional.ofNullable(LANGUAGE_NAMES.get(translation.getCode())).orElse("?");
TagValueHolder valueHolder = TagValueHolder.create().put("code", translation.getCode()).put("name", name).put("percentage", Integer.toString(percentage)).put("color", computeColor(percentage));
translationValuesHolder.add(valueHolder);
}
TagValueHolder tags = TagValueHolder.create().put("languages", translationValuesHolder);
FileIoUtils.generateFileFromTemplate(TEMPLATE_FILE, DOCS_PAGE, tags);
System.out.println("Wrote to '" + DOCS_PAGE + "'");
}
use of tools.utils.TagValueHolder 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 tools.utils.TagValueHolder in project AuthMeReloaded by AuthMe.
the class PermissionsListWriter method executeDefault.
@Override
public void executeDefault() {
final NestedTagValue permissionsTagValue = generatePermissionsList();
TagValueHolder tags = TagValueHolder.create().put("nodes", permissionsTagValue);
FileIoUtils.generateFileFromTemplate(TEMPLATE_FILE, PERMISSIONS_OUTPUT_FILE, tags);
System.out.println("Wrote to '" + PERMISSIONS_OUTPUT_FILE + "'");
}
use of tools.utils.TagValueHolder in project AuthMeReloaded by AuthMe.
the class UpdateConfigPageTask method executeDefault.
@Override
public void executeDefault() {
File config = null;
try {
// Create empty temporary .yml file and save the config to it
config = File.createTempFile("authme-config-", ".yml");
SettingsManager settingsManager = SettingsManagerBuilder.withYamlFile(config).configurationData(AuthMeSettingsRetriever.buildConfigurationData()).create();
settingsManager.save();
// Get the contents and generate template file
TagValueHolder tagValueHolder = TagValueHolder.create().put("config", FileIoUtils.readFromFile(config.toPath()));
FileIoUtils.generateFileFromTemplate(TEMPLATE_FILE, OUTPUT_FILE, tagValueHolder);
System.out.println("Wrote to '" + OUTPUT_FILE + "'");
} catch (IOException e) {
throw new IllegalStateException(e);
} finally {
FileUtils.delete(config);
}
}
Aggregations