mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-29 11:59:17 +00:00
refactor: use paper command api
This commit is contained in:
@@ -16,6 +16,13 @@ import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class BotArgumentType implements CustomArgumentType.Converted<@NotNull ServerBot, @NotNull String> {
|
||||
|
||||
private BotArgumentType() {
|
||||
}
|
||||
|
||||
public static @NotNull BotArgumentType bot() {
|
||||
return new BotArgumentType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <S> @NotNull CompletableFuture<Suggestions> listSuggestions(com.mojang.brigadier.context.@NotNull CommandContext<S> context, @NotNull SuggestionsBuilder builder) {
|
||||
Collection<ServerBot> bots = BotList.INSTANCE.bots;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ActionCommand extends BotSubcommand {
|
||||
public static class BotArgument extends ArgumentNode<ServerBot> {
|
||||
|
||||
private BotArgument() {
|
||||
super("bot", new BotArgumentType());
|
||||
super("bot", BotArgumentType.bot());
|
||||
children(
|
||||
StartCommand::new,
|
||||
StopCommand::new,
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ConfigCommand extends BotSubcommand {
|
||||
private static class BotArgument extends ArgumentNode<ServerBot> {
|
||||
|
||||
private BotArgument() {
|
||||
super("bot", new BotArgumentType());
|
||||
super("bot", BotArgumentType.bot());
|
||||
Configs.getConfigs().stream().map(this::configNodeCreator).forEach(this::children);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public class RemoveCommand extends BotSubcommand {
|
||||
|
||||
private static class BotArgument extends ArgumentNode<ServerBot> {
|
||||
private BotArgument() {
|
||||
super("bot", new BotArgumentType());
|
||||
super("bot", BotArgumentType.bot());
|
||||
children(RemoveTimeArgument::new);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class SaveCommand extends BotSubcommand {
|
||||
private static class BotArgument extends ArgumentNode<ServerBot> {
|
||||
|
||||
private BotArgument() {
|
||||
super("bot", new BotArgumentType());
|
||||
super("bot", BotArgumentType.bot());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user