From 109845d5e4ef229e83d679b2e57ddb86441afc7e Mon Sep 17 00:00:00 2001 From: YuTian <2953516620@qq.com> Date: Thu, 8 Aug 2024 05:00:46 +0800 Subject: [PATCH] 1.3.6 --- .../listener/PlayerChatInputListener.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/io/yutian/elementoriginlib/listener/PlayerChatInputListener.java b/src/main/java/com/io/yutian/elementoriginlib/listener/PlayerChatInputListener.java index d7ba65a..21e929d 100644 --- a/src/main/java/com/io/yutian/elementoriginlib/listener/PlayerChatInputListener.java +++ b/src/main/java/com/io/yutian/elementoriginlib/listener/PlayerChatInputListener.java @@ -22,17 +22,19 @@ public class PlayerChatInputListener extends IListener { event.setCancelled(true); String string = event.getMessage(); Player player = event.getPlayer(); - PlayerChatInput playerInput = PlayerChatInputManager.getInput(player); - if (string.toLowerCase().trim().equalsIgnoreCase("取消") || string.toLowerCase().trim().equalsIgnoreCase("none") || string.toLowerCase().trim().equalsIgnoreCase("cancle")) { - playerInput.cancle(); - PlayerChatInputManager.removeInput(player); - player.sendMessage("playerchatinput.cancle"); - return; - } - Bukkit.getScheduler().runTask(ElementOriginLib.inst(), ()-> playerInput.call(string)); - if (playerInput.isCall() || playerInput.isCancel()) { - PlayerChatInputManager.removeInput(player); - } + Bukkit.getScheduler().runTask(ElementOriginLib.inst(), ()-> { + PlayerChatInput playerInput = PlayerChatInputManager.getInput(player); + if (string.toLowerCase().trim().equalsIgnoreCase("取消") || string.toLowerCase().trim().equalsIgnoreCase("none") || string.toLowerCase().trim().equalsIgnoreCase("cancle")) { + playerInput.cancle(); + PlayerChatInputManager.removeInput(player); + player.sendMessage("playerchatinput.cancle"); + return; + } + playerInput.call(string); + if (playerInput.isCall() || playerInput.isCancel()) { + PlayerChatInputManager.removeInput(player); + } + }); } }