Fixes a bug with Commands not being able to find subcommand if defined label contains capital letter. (#1724)

This commit is contained in:
BONNe 2021-03-28 04:19:44 +03:00 committed by GitHub
parent 9220f9652b
commit dc829786d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -182,13 +182,13 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
this.parent = parent;
subCommandLevel = parent.getLevel() + 1;
// Add this sub-command to the parent
parent.getSubCommands().put(label, this);
parent.getSubCommands().put(label.toLowerCase(java.util.Locale.ENGLISH), this);
setAliases(new ArrayList<>(Arrays.asList(aliases)));
subCommands = new LinkedHashMap<>();
subCommandAliases = new LinkedHashMap<>();
// Add aliases to the parent for this command
for (String alias : aliases) {
parent.getSubCommandAliases().put(alias, this);
parent.getSubCommandAliases().put(alias.toLowerCase(java.util.Locale.ENGLISH), this);
}
setUsage("");
// Inherit permission prefix