From 20783b1e61789c9c231aa9c48e9554d95fcdb163 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Mon, 24 Jul 2017 13:00:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BD=BF=E7=94=A8=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E5=8F=91=E9=80=81TellRaw=20=E5=85=BC=E5=AE=B9=E8=80=81?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- src/main/java/pw/yumc/YumCore/tellraw/Tellraw.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/pw/yumc/YumCore/tellraw/Tellraw.java b/src/main/java/pw/yumc/YumCore/tellraw/Tellraw.java index 2adcaac..e2b85fd 100644 --- a/src/main/java/pw/yumc/YumCore/tellraw/Tellraw.java +++ b/src/main/java/pw/yumc/YumCore/tellraw/Tellraw.java @@ -1,5 +1,6 @@ package pw.yumc.YumCore.tellraw; +import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -25,7 +26,12 @@ public class Tellraw implements Cloneable { static { if (Bukkit.getVersion().contains("Paper") || Bukkit.getVersion().contains("Torch")) { - if (!C.init) { + try { + Class AsyncCatcherClass = Class.forName("org.spigotmc.AsyncCatcher"); + Field enabledField = AsyncCatcherClass.getDeclaredField("enabled"); + enabledField.setAccessible(true); + enabledField.set(null, false); + } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException ex) { Log.console("§c========== §4警 告 §c=========="); Log.console("§a 当前服务器为 §6Paper §a或 §6Torch "); Log.console("§c 异步命令会刷报错 §b不影响使用"); @@ -175,11 +181,7 @@ public class Tellraw implements Cloneable { public void send(final CommandSender sender) { final String json = toJsonString(); if (sender instanceof Player && json.getBytes().length < 32000) { - if (C.init) { - C.sendJson((Player) sender, json, 0); - } else { - Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "tellraw " + sender.getName() + " " + json); - } + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "tellraw " + sender.getName() + " " + json); } else { sender.sendMessage(toOldMessageFormat()); }