From 426f489de098555f57a7b49ef35bf5dda91b9480 Mon Sep 17 00:00:00 2001 From: huanmeng_qwq <1871735932@qq.com> Date: Tue, 13 Feb 2024 13:06:13 +0800 Subject: [PATCH] =?UTF-8?q?litecommands=E7=89=88=E6=9C=AC=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E8=87=B33.3.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../kookbc/impl/command/litecommands/StringHandler.java | 7 +------ .../command/litecommands/tools/KookMessageContextual.java | 6 +----- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index a37ae207..0e56f1f5 100644 --- a/pom.xml +++ b/pom.xml @@ -304,7 +304,7 @@ dev.rollczi litecommands-framework - 3.3.3 + 3.3.4 diff --git a/src/main/java/snw/kookbc/impl/command/litecommands/StringHandler.java b/src/main/java/snw/kookbc/impl/command/litecommands/StringHandler.java index 2406518b..e22a7f14 100644 --- a/src/main/java/snw/kookbc/impl/command/litecommands/StringHandler.java +++ b/src/main/java/snw/kookbc/impl/command/litecommands/StringHandler.java @@ -31,12 +31,7 @@ class StringHandler implements ResultHandler { @Override public void handle(Invocation invocation, String result, ResultHandlerChain chain) { CommandSender sender = invocation.sender(); - Message message = null; - try { - message = invocation.context().get(Message.class).orElse(null); - } catch (NullPointerException ignored) { - } - // Core core = invocation.context().get(Core.class).orElseThrow(() -> new IllegalStateException("Core is not present")); + Message message = invocation.context().get(Message.class).orElse(null); if (sender instanceof User) { if (message != null) { message.reply(result); diff --git a/src/main/java/snw/kookbc/impl/command/litecommands/tools/KookMessageContextual.java b/src/main/java/snw/kookbc/impl/command/litecommands/tools/KookMessageContextual.java index 670af5d5..bfec7be3 100644 --- a/src/main/java/snw/kookbc/impl/command/litecommands/tools/KookMessageContextual.java +++ b/src/main/java/snw/kookbc/impl/command/litecommands/tools/KookMessageContextual.java @@ -35,11 +35,7 @@ public class KookMessageContextual implements ContextProvider { @Override public ContextResult provide(Invocation invocation) { - Optional message = Optional.empty(); - try { - message = invocation.context().get(Message.class); - } catch (NullPointerException ignored) { - } + Optional message = invocation.context().get(Message.class); if (message.isPresent()) { return ContextResult.ok(message::get); }