Fix help messages

This commit is contained in:
Josh Roy 2024-02-04 20:24:25 -05:00
parent d29f335d6b
commit bec6eec62e
No known key found for this signature in database
GPG Key ID: 86A69D08540BC29A
2 changed files with 8 additions and 7 deletions

View File

@ -7,6 +7,7 @@ import com.earth2me.essentials.textreader.IText;
import com.earth2me.essentials.textreader.KeywordReplacer;
import com.earth2me.essentials.textreader.TextInput;
import com.earth2me.essentials.textreader.TextPager;
import com.earth2me.essentials.utils.AdventureUtil;
import com.earth2me.essentials.utils.NumberUtil;
import org.bukkit.Server;
import org.bukkit.command.Command;
@ -44,7 +45,7 @@ public class Commandhelp extends EssentialsCommand {
final IEssentialsCommand essCommand = isEssCommand ? ess.getCommandMap().get(knownCmd.getValue().getName()) : null;
if (essCommand != null && !essCommand.getUsageStrings().isEmpty()) {
for (Map.Entry<String, String> usage : essCommand.getUsageStrings().entrySet()) {
user.sendTl("commandHelpLineUsage", usage.getKey().replace("<command>", cmd), usage.getValue());
user.sendTl("commandHelpLineUsage", usage.getKey().replace("<command>", cmd), AdventureUtil.parsed(usage.getValue()));
}
} else {
user.sendMessage(knownCmd.getValue().getUsage());

View File

@ -50,7 +50,7 @@ public class HelpInput implements IText {
if (pluginNameLow.equals(match)) {
lines.clear();
newLines.clear();
lines.add(user.playerTl("helpFrom", p.getDescription().getName()));
lines.add(AdventureUtil.miniToLegacy(user.playerTl("helpFrom", p.getDescription().getName())));
}
final boolean isOnWhitelist = user.isAuthorized("essentials.help." + pluginNameLow);
@ -69,7 +69,7 @@ public class HelpInput implements IText {
if (pluginNameLow.contains("essentials")) {
final String node = "essentials." + commandName;
if (!ess.getSettings().isCommandDisabled(commandName) && user.isAuthorized(node)) {
pluginLines.add(user.playerTl("helpLine", commandName, commandDescription));
pluginLines.add(AdventureUtil.miniToLegacy(user.playerTl("helpLine", commandName, commandDescription)));
}
} else {
if (ess.getSettings().showNonEssCommandsInHelp()) {
@ -82,7 +82,7 @@ public class HelpInput implements IText {
}
if (isOnWhitelist || user.isAuthorized("essentials.help." + pluginNameLow + "." + commandName)) {
pluginLines.add(user.playerTl("helpLine", commandName, commandDescription));
pluginLines.add(AdventureUtil.miniToLegacy(user.playerTl("helpLine", commandName, commandDescription)));
} else if (permissions.length != 0) {
boolean enabled = false;
@ -94,11 +94,11 @@ public class HelpInput implements IText {
}
if (enabled) {
pluginLines.add(user.playerTl("helpLine", commandName, commandDescription));
pluginLines.add(AdventureUtil.miniToLegacy(user.playerTl("helpLine", commandName, commandDescription)));
}
} else {
if (!ess.getSettings().hidePermissionlessHelp()) {
pluginLines.add(user.playerTl("helpLine", commandName, commandDescription));
pluginLines.add(AdventureUtil.miniToLegacy(user.playerTl("helpLine", commandName, commandDescription)));
}
}
}
@ -112,7 +112,7 @@ public class HelpInput implements IText {
break;
}
if (match.equalsIgnoreCase("")) {
lines.add(user.playerTl("helpPlugin", pluginName, pluginNameLow));
lines.add(AdventureUtil.miniToLegacy(user.playerTl("helpPlugin", pluginName, pluginNameLow)));
}
}
} catch (final NullPointerException ignored) {