mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-01-03 22:08:28 +00:00
Add config option to disable verbose usage strings (#4396)
Co-authored-by: MD <1917406+mdcfe@users.noreply.github.com> ```yml # Whether or not Essentials should show detailed command usages. # If set to false, Essentials will collapse all usages in to one single usage message. verbose-command-usages: true ``` This PR also fixes a regression in legacy usage strings where the `<command>` wasn't replaced.
This commit is contained in:
parent
ac8a13f039
commit
42293596f3
4 changed files with 13 additions and 2 deletions
|
@ -770,12 +770,12 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
|||
sender.sendMessage(tl("commandHelpLine1", commandLabel));
|
||||
sender.sendMessage(tl("commandHelpLine2", command.getDescription()));
|
||||
sender.sendMessage(tl("commandHelpLine3"));
|
||||
if (!cmd.getUsageStrings().isEmpty()) {
|
||||
if (getSettings().isVerboseCommandUsages() && !cmd.getUsageStrings().isEmpty()) {
|
||||
for (Map.Entry<String, String> usage : cmd.getUsageStrings().entrySet()) {
|
||||
sender.sendMessage(tl("commandHelpLineUsage", usage.getKey().replace("<command>", commandLabel), usage.getValue()));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(command.getUsage());
|
||||
sender.sendMessage(command.getUsage().replace("<command>", commandLabel));
|
||||
}
|
||||
if (!ex.getMessage().isEmpty()) {
|
||||
sender.sendMessage(ex.getMessage());
|
||||
|
|
|
@ -126,6 +126,8 @@ public interface ISettings extends IConf {
|
|||
|
||||
Set<String> getDisabledCommands();
|
||||
|
||||
boolean isVerboseCommandUsages();
|
||||
|
||||
boolean isCommandOverridden(String name);
|
||||
|
||||
boolean isDebug();
|
||||
|
|
|
@ -289,6 +289,11 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
return disabledCommands;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVerboseCommandUsages() {
|
||||
return config.getBoolean("verbose-command-usages", true);
|
||||
}
|
||||
|
||||
private void _addAlternativeCommand(final String label, final Command current) {
|
||||
Command cmd = ess.getAlternativeCommandsHandler().getAlternative(label);
|
||||
if (cmd == null) {
|
||||
|
|
|
@ -170,6 +170,10 @@ disabled-commands:
|
|||
# - nick
|
||||
# - clear
|
||||
|
||||
# Whether or not Essentials should show detailed command usages.
|
||||
# If set to false, Essentials will collapse all usages in to one single usage message.
|
||||
verbose-command-usages: true
|
||||
|
||||
# These commands will be shown to players with socialSpy enabled.
|
||||
# You can add commands from other plugins you may want to track or
|
||||
# remove commands that are used for something you dont want to spy on.
|
||||
|
|
Loading…
Reference in a new issue