1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-11-24 02:08:48 +00:00

全版本兼容”

This commit is contained in:
xjboss 2019-03-12 16:31:27 +00:00
parent 4f8b43bdb9
commit e26d5490be

View File

@ -54,10 +54,8 @@ public class C {
static { static {
version=getNMSVersion(); version=getNMSVersion();
titlePAB=false; titlePAB=false;
try {
try { try {
cauldron1710 = version.equals("v1_7_R4") && Package.getPackage("net.minecraftforge.cauldron") != null; cauldron1710 = version.equals("v1_7_R4") && Package.getPackage("net.minecraftforge.cauldron") != null;
}catch (Exception e){}
if(cauldron1710) { if(cauldron1710) {
try{ try{
Class.forName("cc.uraniummc.Uranium"); Class.forName("cc.uraniummc.Uranium");
@ -79,7 +77,7 @@ public class C {
packetType = Class.forName(a("PacketPlayOutChat")); packetType = Class.forName(a("PacketPlayOutChat"));
} }
Arrays.stream(packetType.getConstructors()).forEach(c -> { Arrays.stream(packetType.getConstructors()).forEach(c -> {
if (c.getParameterTypes().length == 2) { if (c.getParameterTypes().length == 2&&!c.getParameterTypes()[1].getName().equals("boolean")) {
packetTypeConstructor = c; packetTypeConstructor = c;
} }
}); });
@ -97,7 +95,11 @@ public class C {
nmsChatMessageTypeClassValueOf = nmsChatMessageTypeClass.getDeclaredMethod("valueOf", String.class); nmsChatMessageTypeClassValueOf = nmsChatMessageTypeClass.getDeclaredMethod("valueOf", String.class);
} }
} catch (Exception e) { } catch (Exception e) {
try {
packetTypeConstructor = packetType.getConstructor(String.class); packetTypeConstructor = packetType.getConstructor(String.class);
}catch (Exception e2){
packetTypeConstructor = packetType.getConstructor(nmsIChatBaseComponent);
}
} }
Class<?> typeCraftPlayer = Class.forName(b("entity.CraftPlayer")); Class<?> typeCraftPlayer = Class.forName(b("entity.CraftPlayer"));
getHandle = typeCraftPlayer.getMethod("getHandle"); getHandle = typeCraftPlayer.getMethod("getHandle");