From 6583a6a8d9d8388ec8d26e093ca2ab75f082a2e5 Mon Sep 17 00:00:00 2001 From: xjboss Date: Tue, 12 Mar 2019 11:22:49 +0000 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=BA=9F=E7=89=A9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pw/yumc/YumCore/bukkit/compatible/C.java | 47 ++++++++----------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/src/main/java/pw/yumc/YumCore/bukkit/compatible/C.java b/src/main/java/pw/yumc/YumCore/bukkit/compatible/C.java index f165d91..fc3ccd2 100644 --- a/src/main/java/pw/yumc/YumCore/bukkit/compatible/C.java +++ b/src/main/java/pw/yumc/YumCore/bukkit/compatible/C.java @@ -69,13 +69,6 @@ public class C { chatSerializer = nmsChatSerializer.getMethod("func_150699_a", String.class); nmsIChatBaseComponent = Class.forName("net.minecraft.util.IChatComponent"); packetType = Class.forName("net.minecraft.network.play.server.S02PacketChat"); - Arrays.stream(packetType.getConstructors()).forEach(c -> { - if (c.getParameterTypes().length == 2&&uranium) { - packetTypeConstructor = c; - }else if(c.getParameterTypes().length==1){ - packetTypeConstructor = c; - } - }); }else { newversion = Integer.parseInt(version.split("_")[1]) > 7; titlePAB=newversion; @@ -83,28 +76,28 @@ public class C { chatSerializer = nmsChatSerializer.getMethod("a", String.class); nmsIChatBaseComponent = Class.forName(a("IChatBaseComponent")); packetType = Class.forName(a("PacketPlayOutChat")); - Arrays.stream(packetType.getConstructors()).forEach(c -> { - if (c.getParameterTypes().length == 2) { - packetTypeConstructor = c; - } - }); } - try { - nmsChatMessageTypeClass = packetTypeConstructor.getParameterTypes()[1]; - if (nmsChatMessageTypeClass.isEnum()) { - chatMessageTypes = nmsChatMessageTypeClass.getEnumConstants(); - } else { - switch (nmsChatMessageTypeClass.getName()) { - case "int": - nmsChatMessageTypeClass = Integer.class; - case "byte": - nmsChatMessageTypeClass = Byte.class; - } - nmsChatMessageTypeClassValueOf = nmsChatMessageTypeClass.getDeclaredMethod("valueOf", String.class); - } - } catch (Exception e) { - packetTypeConstructor = packetType.getConstructor(String.class); + Arrays.stream(packetType.getConstructors()).forEach(c -> { + if (c.getParameterTypes().length == 2) { + packetTypeConstructor = c; } + }); + try { + nmsChatMessageTypeClass = packetTypeConstructor.getParameterTypes()[1]; + if (nmsChatMessageTypeClass.isEnum()) { + chatMessageTypes = nmsChatMessageTypeClass.getEnumConstants(); + } else { + switch (nmsChatMessageTypeClass.getName()) { + case "int": + nmsChatMessageTypeClass = Integer.class; + case "byte": + nmsChatMessageTypeClass = Byte.class; + } + nmsChatMessageTypeClassValueOf = nmsChatMessageTypeClass.getDeclaredMethod("valueOf", String.class); + } + } catch (Exception e) { + packetTypeConstructor = packetType.getConstructor(String.class); + } Class typeCraftPlayer = Class.forName(b("entity.CraftPlayer")); getHandle = typeCraftPlayer.getMethod("getHandle"); if(cauldron1710) {