Search in sources :

Example 1 with HelpMessage

use of fr.xephi.authme.command.help.HelpMessage in project AuthMeReloaded by AuthMe.

the class HelpTranslationGenerator method generateHelpMessageEntries.

/**
 * Generates entries for a complete help text file.
 *
 * @return help text entries to save
 */
private Map<String, Object> generateHelpMessageEntries() {
    Map<String, Object> messageEntries = new LinkedHashMap<>(HelpMessage.values().length);
    for (HelpMessage message : HelpMessage.values()) {
        messageEntries.put(message.getEntryKey(), helpMessagesService.getMessage(message));
    }
    Map<String, String> defaultPermissions = new LinkedHashMap<>();
    for (DefaultPermission defaultPermission : DefaultPermission.values()) {
        defaultPermissions.put(HelpMessagesService.getDefaultPermissionsSubPath(defaultPermission), helpMessagesService.getMessage(defaultPermission));
    }
    messageEntries.put("defaultPermissions", defaultPermissions);
    Map<String, String> sectionEntries = new LinkedHashMap<>(HelpSection.values().length);
    for (HelpSection section : HelpSection.values()) {
        sectionEntries.put(section.getEntryKey(), helpMessagesService.getMessage(section));
    }
    Map<String, Object> commandEntries = new LinkedHashMap<>();
    for (CommandDescription command : commandInitializer.getCommands()) {
        generateCommandEntries(command, commandEntries);
    }
    return ImmutableMap.of("common", messageEntries, "section", sectionEntries, "commands", commandEntries);
}
Also used : HelpSection(fr.xephi.authme.command.help.HelpSection) CommandDescription(fr.xephi.authme.command.CommandDescription) HelpMessage(fr.xephi.authme.command.help.HelpMessage) DefaultPermission(fr.xephi.authme.permission.DefaultPermission) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

CommandDescription (fr.xephi.authme.command.CommandDescription)1 HelpMessage (fr.xephi.authme.command.help.HelpMessage)1 HelpSection (fr.xephi.authme.command.help.HelpSection)1 DefaultPermission (fr.xephi.authme.permission.DefaultPermission)1 LinkedHashMap (java.util.LinkedHashMap)1