版本更新至 4.13
+ TellrawJoin 新增 append 方法用于拼接其他 json 信息 o 修复 1.12 版本载入报错的问题 o 修复 json 信息发送方式错误的问题
This commit is contained in:
@@ -140,6 +140,8 @@ public class TLocale {
|
||||
|
||||
public static class Tellraw extends TLocale {
|
||||
|
||||
private static final Class<?> chatSerializer = NMSUtils.getNMSClassSilent("ChatSerializer", "IChatBaseComponent");
|
||||
private static final Method chatSerializerA = NMSUtils.getMethodSilent(chatSerializer, "a", String.class);
|
||||
private static final Field playerConnection = NMSUtils.getFieldSilent(NMSUtil19.class_EntityPlayer, "playerConnection");
|
||||
private static final Method sendPacket = NMSUtils.getMethodSilent(NMSUtil19.class_PlayerConnection, "sendPacket", NMSUtil19.class_Packet);
|
||||
private static final Constructor<?> PacketPlayOutChat = NMSUtils.getConstructorSilent(NMSUtil19.class_PacketPlayOutChat, NMSUtil19.class_IChatBaseComponent);
|
||||
@@ -147,7 +149,7 @@ public class TLocale {
|
||||
public static void send(CommandSender sender, String rawMessage) {
|
||||
if (sender instanceof Player) {
|
||||
try {
|
||||
sendPacket.invoke(playerConnection.get(NMSUtils.getHandle(sender)), PacketPlayOutChat.newInstance(rawMessage));
|
||||
sendPacket.invoke(playerConnection.get(NMSUtils.getHandle(sender)), PacketPlayOutChat.newInstance(chatSerializerA.invoke(null, rawMessage)));
|
||||
} catch (Exception e) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "tellraw " + sender.getName() + " " + rawMessage);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user