From 31290e76b1502290cd00db7293077892c1075a9f Mon Sep 17 00:00:00 2001 From: huanmeng-qwq Date: Tue, 27 Aug 2024 14:23:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D@Result=E6=B3=A8?= =?UTF-8?q?=E8=A7=A3=E6=97=A0=E6=B3=95=E8=A2=AB=E6=AD=A3=E7=A1=AE=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/command/litecommands/LiteKookFactory.java | 9 +-------- .../annotations/result/ResultAnnotationResolver.java | 4 ++-- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/main/java/snw/kookbc/impl/command/litecommands/LiteKookFactory.java b/src/main/java/snw/kookbc/impl/command/litecommands/LiteKookFactory.java index ffc978dc..487dae04 100644 --- a/src/main/java/snw/kookbc/impl/command/litecommands/LiteKookFactory.java +++ b/src/main/java/snw/kookbc/impl/command/litecommands/LiteKookFactory.java @@ -20,16 +20,9 @@ import dev.rollczi.litecommands.LiteCommandsBuilder; import dev.rollczi.litecommands.LiteCommandsFactory; -import dev.rollczi.litecommands.LiteCommandsInternal; import dev.rollczi.litecommands.extension.annotations.LiteAnnotationsProcessorExtension; -import dev.rollczi.litecommands.handler.result.ResultHandler; -import dev.rollczi.litecommands.handler.result.ResultHandlerChain; -import dev.rollczi.litecommands.invocation.Invocation; -import dev.rollczi.litecommands.message.InvokedMessage; -import dev.rollczi.litecommands.processor.LiteBuilderProcessor; import snw.jkook.Core; import snw.jkook.HttpAPI; -import snw.jkook.command.CommandException; import snw.jkook.command.CommandSender; import snw.jkook.command.ConsoleCommandSender; import snw.jkook.entity.CustomEmoji; @@ -80,8 +73,8 @@ public static .bind(Plugin.class, () -> plugin) .bindUnsafe(plugin.getClass(), () -> plugin) .bind(KBCClient.class, () -> client) - .extension(processorExtension) .validatorGlobal(new ResultTypeValidator()) + .extension(processorExtension) .context(Message.class, new KookMessageContextual()) .context(User.class, new KookOnlyUserContextual<>("只有用户才能执行该命令")) .context(ConsoleCommandSender.class, new KookOnlyConsoleContextual<>("只有后台才能执行该命令")) diff --git a/src/main/java/snw/kookbc/impl/command/litecommands/annotations/result/ResultAnnotationResolver.java b/src/main/java/snw/kookbc/impl/command/litecommands/annotations/result/ResultAnnotationResolver.java index f74a05b2..7075627f 100644 --- a/src/main/java/snw/kookbc/impl/command/litecommands/annotations/result/ResultAnnotationResolver.java +++ b/src/main/java/snw/kookbc/impl/command/litecommands/annotations/result/ResultAnnotationResolver.java @@ -36,7 +36,7 @@ public ResultAnnotationResolver(Logger logger) { @Override public AnnotationInvoker process(AnnotationInvoker invoker) { - return invoker.on(Result.class, (annotation, metaHolder) -> { + return invoker.onExecutorStructure(Result.class, (annotation, builder, executorProvider) -> { ResultType resultTypes = annotation.value(); if (!Objects.equals(ResultType.class, annotation.custom())) { try { @@ -47,7 +47,7 @@ public AnnotationInvoker process(AnnotationInvoker invoker) { } } if (resultTypes == ResultTypes.DEFAULT) return; - metaHolder.meta().put(ResultType.RESULT_TYPE_KEY, resultTypes); + builder.meta().put(ResultType.RESULT_TYPE_KEY, resultTypes); }); }