Add /huskhomes help (Command list)

This commit is contained in:
William committed 2022-08-24 15:10:32 +01:00
1 parent 58b8c25a29
commit 80865aa060
5 files changed
+60 -4

No files matched your search

@@ -20,7 +20,7 @@ public class HuskHomesCommand extends CommandBase implements ConsoleExecutable,
protected HuskHomesCommand(@NotNull HuskHomes implementor) {
super("huskhomes", Permission.COMMAND_HUSKHOMES, implementor);
aboutMenu = AboutMenu.create("HuskHomes")
this.aboutMenu = AboutMenu.create("HuskHomes")
.withDescription("A powerful, intuitive and flexible teleportation suite")
.withVersion(implementor.getPluginVersion())
.addAttribution("Author",
@@ -48,10 +48,26 @@ public class HuskHomesCommand extends CommandBase implements ConsoleExecutable,
sendAboutMenu(onlineUser);
return;
}
if (args.length > 2) {
plugin.getLocales().getLocale("error_invalid_syntax", "/huskhomes [about|help|reload|update]")
.ifPresent(onlineUser::sendMessage);
return;
}
switch (args[0].toLowerCase()) {
case "about" -> sendAboutMenu(onlineUser);
case "help" -> {
// todo sendHelpMenu(onlineUser);
int page = 1;
if (args.length == 2) {
try {
page = Integer.parseInt(args[1]);
} catch (NumberFormatException ignored) {
plugin.getLocales().getLocale("error_invalid_syntax", "/huskhomes help <page>")
.ifPresent(onlineUser::sendMessage);
return;
}
}
onlineUser.sendMessage(plugin.getCache().getCommandList(plugin.getLocales(), plugin.getCommands(),
plugin.getSettings().listItemsPerPage, page));
}
case "reload" -> {