mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-22 09:08:03 +01:00
Fixed issue where Optional was not being explicitly checked before get.
This commit is contained in:
parent
2d64070d3f
commit
fdc7a62990
@ -196,16 +196,16 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
if (subCommand.hasSubCommmands()) {
|
||||
if (DEBUG)
|
||||
Bukkit.getLogger().info("DEBUG: This command has subcommands");
|
||||
if (subCommand.getSubCommand(args[i]).isPresent()) {
|
||||
Optional<CompositeCommand> sub = subCommand.getSubCommand(args[i]);
|
||||
if (!sub.isPresent()) {
|
||||
return subCommand;
|
||||
}
|
||||
// Step down one
|
||||
subCommand = subCommand.getSubCommand(args[i]).get();
|
||||
subCommand = sub.orElse(subCommand);
|
||||
if (DEBUG)
|
||||
Bukkit.getLogger().info("DEBUG: Moved to " + subCommand.getLabel());
|
||||
// Set the label
|
||||
subCommand.setLabel(args[i]);
|
||||
} else {
|
||||
return subCommand;
|
||||
}
|
||||
} else {
|
||||
// We are at the end of the walk
|
||||
if (DEBUG)
|
||||
|
Loading…
Reference in New Issue
Block a user