mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-30 13:07:46 +01:00
Fixes "Unknown command" when using uppercase characters in commands
Fixes #204.
This commit is contained in:
parent
5ec5a59dd4
commit
bfe059f191
@ -117,8 +117,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
subCommandAliases = new LinkedHashMap<>();
|
||||
// Register command if it is not already registered
|
||||
if (plugin.getCommand(label) == null) {
|
||||
plugin.getCommandsManager()
|
||||
.registerCommand(this);
|
||||
plugin.getCommandsManager().registerCommand(this);
|
||||
}
|
||||
setup();
|
||||
if (!getSubCommand("help").isPresent() && !label.equals("help")) {
|
||||
@ -312,11 +311,12 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
* @return CompositeCommand or null if none found
|
||||
*/
|
||||
public Optional<CompositeCommand> getSubCommand(String label) {
|
||||
if (subCommands.containsKey(label.toLowerCase())) {
|
||||
label = label.toLowerCase();
|
||||
if (subCommands.containsKey(label)) {
|
||||
return Optional.ofNullable(subCommands.get(label));
|
||||
}
|
||||
// Try aliases
|
||||
if (subCommandAliases.containsKey(label.toLowerCase())) {
|
||||
if (subCommandAliases.containsKey(label)) {
|
||||
return Optional.ofNullable(subCommandAliases.get(label));
|
||||
}
|
||||
return Optional.empty();
|
||||
|
Loading…
Reference in New Issue
Block a user