mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-26 20:26:01 +01:00
List all subcommands if debug section is unknown
This commit is contained in:
parent
a847deac16
commit
8a7c8c36f2
@ -26,20 +26,23 @@ public class DebugCommand implements ExecutableCommand {
|
||||
|
||||
@Override
|
||||
public void executeCommand(CommandSender sender, List<String> arguments) {
|
||||
if (arguments.isEmpty()) {
|
||||
DebugSection debugSection = getDebugSection(arguments);
|
||||
if (debugSection == null) {
|
||||
sender.sendMessage("Available sections:");
|
||||
getSections().values()
|
||||
.forEach(e -> sender.sendMessage("- " + e.getName() + ": " + e.getDescription()));
|
||||
} else {
|
||||
DebugSection debugSection = getSections().get(arguments.get(0).toLowerCase());
|
||||
if (debugSection == null) {
|
||||
sender.sendMessage("Unknown subcommand");
|
||||
} else {
|
||||
debugSection.execute(sender, arguments.subList(1, arguments.size()));
|
||||
}
|
||||
debugSection.execute(sender, arguments.subList(1, arguments.size()));
|
||||
}
|
||||
}
|
||||
|
||||
private DebugSection getDebugSection(List<String> arguments) {
|
||||
if (arguments.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return getSections().get(arguments.get(0).toLowerCase());
|
||||
}
|
||||
|
||||
// Lazy getter
|
||||
private Map<String, DebugSection> getSections() {
|
||||
if (sections == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user