mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-03 06:57:41 +01:00
Fixed issue where Optional was not being explicitly checked before get.
This commit is contained in:
parent
2d64070d3f
commit
fdc7a62990
@ -173,7 +173,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
|||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute and trim args
|
// Execute and trim args
|
||||||
return cmd.execute(user, Arrays.asList(args).subList(cmd.subCommandLevel, args.length));
|
return cmd.execute(user, Arrays.asList(args).subList(cmd.subCommandLevel, args.length));
|
||||||
}
|
}
|
||||||
@ -195,17 +195,17 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
|||||||
// get the subcommand corresponding to the arg
|
// get the subcommand corresponding to the arg
|
||||||
if (subCommand.hasSubCommmands()) {
|
if (subCommand.hasSubCommmands()) {
|
||||||
if (DEBUG)
|
if (DEBUG)
|
||||||
Bukkit.getLogger().info("DEBUG: This command has subcommands");
|
Bukkit.getLogger().info("DEBUG: This command has subcommands");
|
||||||
if (subCommand.getSubCommand(args[i]).isPresent()) {
|
Optional<CompositeCommand> sub = subCommand.getSubCommand(args[i]);
|
||||||
// Step down one
|
if (!sub.isPresent()) {
|
||||||
subCommand = subCommand.getSubCommand(args[i]).get();
|
|
||||||
if (DEBUG)
|
|
||||||
Bukkit.getLogger().info("DEBUG: Moved to " + subCommand.getLabel());
|
|
||||||
// Set the label
|
|
||||||
subCommand.setLabel(args[i]);
|
|
||||||
} else {
|
|
||||||
return subCommand;
|
return subCommand;
|
||||||
}
|
}
|
||||||
|
// Step down one
|
||||||
|
subCommand = sub.orElse(subCommand);
|
||||||
|
if (DEBUG)
|
||||||
|
Bukkit.getLogger().info("DEBUG: Moved to " + subCommand.getLabel());
|
||||||
|
// Set the label
|
||||||
|
subCommand.setLabel(args[i]);
|
||||||
} else {
|
} else {
|
||||||
// We are at the end of the walk
|
// We are at the end of the walk
|
||||||
if (DEBUG)
|
if (DEBUG)
|
||||||
|
Loading…
Reference in New Issue
Block a user