Skip to content

Commit 3d03cf3

Browse files
authored
Fix command descriptions not using player's locale (#6508)
Usage descriptions were resolved once at command construction time via tlLiteral() (server default locale) and cached. Now store the translation key instead and resolve per-player at display time using playerTl()/tl(). Fixes #6353
1 parent 57a8c59 commit 3d03cf3

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎Essentials/src/main/java/com/earth2me/essentials/Essentials.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ public boolean onCommandEssentials(final CommandSender cSender, final Command co
837837
sender.sendTl("commandHelpLine2", description);
838838
sender.sendTl("commandHelpLine3");
839839
for (Map.Entry<String, String> usage : cmd.getUsageStrings().entrySet()) {
840-
sender.sendTl("commandHelpLineUsage", AdventureUtil.parsed(usage.getKey().replace("<command>", commandLabel)), AdventureUtil.parsed(usage.getValue()));
840+
sender.sendTl("commandHelpLineUsage", AdventureUtil.parsed(usage.getKey().replace("<command>", commandLabel)), AdventureUtil.parsed(sender.tl(usage.getValue())));
841841
}
842842
} else {
843843
sender.sendMessage(command.getDescription());

‎Essentials/src/main/java/com/earth2me/essentials/commands/Commandhelp.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected void run(final Server server, final User user, final String commandLab
5454
user.sendTl("commandHelpLine3");
5555
if (essCommand != null && !essCommand.getUsageStrings().isEmpty()) {
5656
for (Map.Entry<String, String> usage : essCommand.getUsageStrings().entrySet()) {
57-
user.sendTl("commandHelpLineUsage", AdventureUtil.parsed(usage.getKey().replace("<command>", cmd)), AdventureUtil.parsed(usage.getValue()));
57+
user.sendTl("commandHelpLineUsage", AdventureUtil.parsed(usage.getKey().replace("<command>", cmd)), AdventureUtil.parsed(user.playerTl(usage.getValue())));
5858
}
5959
} else {
6060
user.sendMessage(bukkit.getUsage());

‎Essentials/src/main/java/com/earth2me/essentials/commands/EssentialsCommand.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected EssentialsCommand(final String name) {
5656
//noinspection InfiniteLoopStatement
5757
while (true) {
5858
final String baseKey = name + "CommandUsage" + i;
59-
addUsageString(tlLiteral(baseKey), tlLiteral(baseKey + "Description"));
59+
addUsageString(tlLiteral(baseKey), baseKey + "Description");
6060
i++;
6161
}
6262
} catch (MissingResourceException ignored) {

0 commit comments

Comments
 (0)