mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-07 02:59:48 +01:00
#293 Fix localized command losing its children
This commit is contained in:
parent
76e6d757da
commit
87f88cb32a
@ -62,7 +62,9 @@ public class HelpMessagesService implements Reloadable {
|
||||
++i;
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
CommandDescription localCommand = builder.build();
|
||||
localCommand.getChildren().addAll(command.getChildren());
|
||||
return localCommand;
|
||||
}
|
||||
|
||||
public String getMessage(HelpMessage message) {
|
||||
|
@ -29,9 +29,10 @@ section:
|
||||
|
||||
# -------------------------------------------------------
|
||||
# You can translate the data for all commands using the below pattern.
|
||||
# So for example to translate /authme reload, create a section "authme.reload", or "login" for /login
|
||||
# For example to translate /authme reload, create a section "authme.reload", or "login" for /login
|
||||
# If the command has arguments, you can use arg1 as below to translate the first argument, and so forth
|
||||
# Translations don't need to be complete; any missing section will be taken from the default silently
|
||||
# Important: Put main commands like "authme" before their children (e.g. "authme.reload")
|
||||
commands:
|
||||
authme.register:
|
||||
description: 'Register a player'
|
||||
|
@ -92,6 +92,20 @@ public class HelpMessagesServiceTest {
|
||||
assertThat(localCommand, sameInstance(command));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldKeepChildrenInLocalCommand() {
|
||||
// given
|
||||
CommandDescription command = TestCommandsUtil.getCommandWithLabel(COMMANDS, "authme");
|
||||
|
||||
// when
|
||||
CommandDescription localCommand = helpMessagesService.buildLocalizedDescription(command);
|
||||
|
||||
// then
|
||||
assertThat(localCommand.getChildren(), equalTo(command.getChildren()));
|
||||
assertThat(localCommand.getDescription(), equalTo("authme cmd"));
|
||||
assertThat(localCommand.getDetailedDescription(), equalTo("Main command"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldGetTranslationsForSectionAndMessage() {
|
||||
// given / when / then
|
||||
|
@ -7,6 +7,8 @@ section:
|
||||
arguments: 'arg.'
|
||||
|
||||
commands:
|
||||
authme:
|
||||
detailedDescription: 'Main command'
|
||||
authme.register:
|
||||
description: 'Registration'
|
||||
detailedDescription: 'Registers the player'
|
||||
|
Loading…
Reference in New Issue
Block a user