Skip to content

Commit

Permalink
Implement bot and attack suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Feb 20, 2024
1 parent 0f9bf90 commit 66ee9a5
Showing 1 changed file with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public void postConstruct() {
literal("online")
.executes(
help(
"Shows connected bots from all attacks",
"Shows connected bots in attacks",
c ->
forEveryAttackEnsureHasBots(
c,
Expand Down Expand Up @@ -699,6 +699,18 @@ public void postConstruct() {
literal("bot")
.then(
argument("bot_names", StringArgumentType.string())
.suggests(
(c, b) -> {
forEveryBot(
c,
bot -> {
b.suggest(bot.meta().minecraftAccount().username());

return Command.SINGLE_SUCCESS;
});

return b.buildFuture();
})
.forward(
dispatcher.getRoot(),
helpRedirect(
Expand All @@ -715,6 +727,18 @@ public void postConstruct() {
literal("attack")
.then(
argument("attack_ids", StringArgumentType.string())
.suggests(
(c, b) -> {
forEveryAttack(
c,
attackManager -> {
b.suggest(attackManager.id());

return Command.SINGLE_SUCCESS;
});

return b.buildFuture();
})
.forward(
dispatcher.getRoot(),
helpRedirect(
Expand Down Expand Up @@ -938,9 +962,9 @@ private void getAllUsage(

if (node.getCommand() != null) {
var helpWrapper = (CommandHelpWrapper) node.getCommand();
if (!helpWrapper.privateCommand()) {
result.add(new HelpData(prefix, helpWrapper.help()));
}
if (!helpWrapper.privateCommand()) {
result.add(new HelpData(prefix, helpWrapper.help()));
}
}

if (node.getRedirect() != null) {
Expand Down

0 comments on commit 66ee9a5

Please sign in to comment.