#293 Translatable help - show translated description of child commands

- Show translated command descriptions when available
- Fix bug where localized command is registered on the parent each time

Thanks to @Maxetto
This commit is contained in:
ljacqu
2016-10-18 19:47:57 +02:00
parent 3dab5cd70c
commit 1d11824367
9 changed files with 112 additions and 85 deletions
@@ -67,6 +67,10 @@ public class HelpMessagesService implements Reloadable {
return localCommand;
}
public String getDescription(CommandDescription command) {
return getText(getCommandPath(command) + DESCRIPTION_SUFFIX, command::getDescription);
}
public String getMessage(HelpMessage message) {
return messageFileHandler.getMessage(message.getKey());
}
@@ -249,7 +249,7 @@ public class HelpProvider implements Reloadable {
String parentCommandPath = String.join(" ", parentLabels);
for (CommandDescription child : command.getChildren()) {
lines.add(" /" + parentCommandPath + " " + child.getLabels().get(0)
+ ChatColor.GRAY + ChatColor.ITALIC + ": " + child.getDescription());
+ ChatColor.GRAY + ChatColor.ITALIC + ": " + helpMessagesService.getDescription(child));
}
}