Search in sources :

Example 1 with CommandInitializer

use of fr.xephi.authme.command.CommandInitializer 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();
}
Also used : YamlFileReader(ch.jalu.configme.resource.YamlFileReader) MessagePathHelper(fr.xephi.authme.message.MessagePathHelper) Collection(java.util.Collection) PropertyReader(ch.jalu.configme.resource.PropertyReader) MemorySection(org.bukkit.configuration.MemorySection) Test(org.junit.Test) CommandInitializer(fr.xephi.authme.command.CommandInitializer) File(java.io.File) CommandDescription(fr.xephi.authme.command.CommandDescription) Matchers.instanceOf(org.hamcrest.Matchers.instanceOf) Assert.assertThat(org.junit.Assert.assertThat) FileConfiguration(org.bukkit.configuration.file.FileConfiguration) List(java.util.List) Matchers.contains(org.hamcrest.Matchers.contains) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) Matchers.equalTo(org.hamcrest.Matchers.equalTo) TestHelper(fr.xephi.authme.TestHelper) CommandDescription(fr.xephi.authme.command.CommandDescription) CommandInitializer(fr.xephi.authme.command.CommandInitializer)

Example 2 with CommandInitializer

use of fr.xephi.authme.command.CommandInitializer 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;
}
Also used : CommandDescription(fr.xephi.authme.command.CommandDescription) CommandInitializer(fr.xephi.authme.command.CommandInitializer) LinkedHashMap(java.util.LinkedHashMap)

Example 3 with CommandInitializer

use of fr.xephi.authme.command.CommandInitializer 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;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) CommandDescription(fr.xephi.authme.command.CommandDescription) CommandInitializer(fr.xephi.authme.command.CommandInitializer)

Example 4 with CommandInitializer

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

the class CommandPageCreater method executeDefault.

@Override
public void executeDefault() {
    CommandInitializer commandInitializer = new CommandInitializer();
    final Collection<CommandDescription> baseCommands = commandInitializer.getCommands();
    NestedTagValue commandTags = new NestedTagValue();
    addCommandsInfo(commandTags, baseCommands);
    FileIoUtils.generateFileFromTemplate(ToolsConstants.TOOLS_SOURCE_ROOT + "docs/commands/commands.tpl.md", OUTPUT_FILE, TagValueHolder.create().put("commands", commandTags));
    System.out.println("Wrote to '" + OUTPUT_FILE + "' with " + baseCommands.size() + " base commands.");
}
Also used : CommandDescription(fr.xephi.authme.command.CommandDescription) CommandInitializer(fr.xephi.authme.command.CommandInitializer) NestedTagValue(tools.utils.TagValue.NestedTagValue)

Aggregations

CommandDescription (fr.xephi.authme.command.CommandDescription)4 CommandInitializer (fr.xephi.authme.command.CommandInitializer)4 PropertyReader (ch.jalu.configme.resource.PropertyReader)1 YamlFileReader (ch.jalu.configme.resource.YamlFileReader)1 TestHelper (fr.xephi.authme.TestHelper)1 MessagePathHelper (fr.xephi.authme.message.MessagePathHelper)1 File (java.io.File)1 Collection (java.util.Collection)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 List (java.util.List)1 MemorySection (org.bukkit.configuration.MemorySection)1 FileConfiguration (org.bukkit.configuration.file.FileConfiguration)1 YamlConfiguration (org.bukkit.configuration.file.YamlConfiguration)1 Matchers.contains (org.hamcrest.Matchers.contains)1 Matchers.equalTo (org.hamcrest.Matchers.equalTo)1 Matchers.instanceOf (org.hamcrest.Matchers.instanceOf)1 Assert.assertThat (org.junit.Assert.assertThat)1 Test (org.junit.Test)1 NestedTagValue (tools.utils.TagValue.NestedTagValue)1