mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-22 00:58:04 +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<>();
|
subCommandAliases = new LinkedHashMap<>();
|
||||||
// Register command if it is not already registered
|
// Register command if it is not already registered
|
||||||
if (plugin.getCommand(label) == null) {
|
if (plugin.getCommand(label) == null) {
|
||||||
plugin.getCommandsManager()
|
plugin.getCommandsManager().registerCommand(this);
|
||||||
.registerCommand(this);
|
|
||||||
}
|
}
|
||||||
setup();
|
setup();
|
||||||
if (!getSubCommand("help").isPresent() && !label.equals("help")) {
|
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
|
* @return CompositeCommand or null if none found
|
||||||
*/
|
*/
|
||||||
public Optional<CompositeCommand> getSubCommand(String label) {
|
public Optional<CompositeCommand> getSubCommand(String label) {
|
||||||
if (subCommands.containsKey(label.toLowerCase())) {
|
label = label.toLowerCase();
|
||||||
|
if (subCommands.containsKey(label)) {
|
||||||
return Optional.ofNullable(subCommands.get(label));
|
return Optional.ofNullable(subCommands.get(label));
|
||||||
}
|
}
|
||||||
// Try aliases
|
// Try aliases
|
||||||
if (subCommandAliases.containsKey(label.toLowerCase())) {
|
if (subCommandAliases.containsKey(label)) {
|
||||||
return Optional.ofNullable(subCommandAliases.get(label));
|
return Optional.ofNullable(subCommandAliases.get(label));
|
||||||
}
|
}
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
|
Loading…
Reference in New Issue
Block a user