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

修复纯净1.7

This commit is contained in:
xjboss 2017-09-08 19:45:12 +08:00
parent 07a39b35d4
commit af35724a4d

View File

@ -103,11 +103,11 @@ public class C {
packetTypeConstructor = c; packetTypeConstructor = c;
} }
}); });
try {
nmsChatMessageTypeClass = packetTypeConstructor.getParameterTypes()[1]; nmsChatMessageTypeClass = packetTypeConstructor.getParameterTypes()[1];
if (nmsChatMessageTypeClass.isEnum()) { if (nmsChatMessageTypeClass.isEnum()) {
chatMessageTypes = nmsChatMessageTypeClass.getEnumConstants(); chatMessageTypes = nmsChatMessageTypeClass.getEnumConstants();
} else { } else {
if(newversion) {
switch (nmsChatMessageTypeClass.getName()) { switch (nmsChatMessageTypeClass.getName()) {
case "int": case "int":
nmsChatMessageTypeClass = Integer.class; nmsChatMessageTypeClass = Integer.class;
@ -116,6 +116,8 @@ public class C {
} }
nmsChatMessageTypeClassValueOf = nmsChatMessageTypeClass.getDeclaredMethod("valueOf", String.class); nmsChatMessageTypeClassValueOf = nmsChatMessageTypeClass.getDeclaredMethod("valueOf", String.class);
} }
}catch (Exception e){
packetTypeConstructor=packetType.getConstructor(String.class);
} }
Class<?> typeCraftPlayer = Class.forName(b("entity.CraftPlayer")); Class<?> typeCraftPlayer = Class.forName(b("entity.CraftPlayer"));
Class<?> typeNMSPlayer = Class.forName(a("EntityPlayer")); Class<?> typeNMSPlayer = Class.forName(a("EntityPlayer"));
@ -173,13 +175,14 @@ public class C {
sendPacket.invoke(connection,Title.packetTitleSendConstructor.newInstance(Title.actions[2],serialized)); sendPacket.invoke(connection,Title.packetTitleSendConstructor.newInstance(Title.actions[2],serialized));
return; return;
}else { }else {
if (!newversion) { if (nmsChatMessageTypeClass==null) {
typeObj = true; sendPacket.invoke(connection, packetTypeConstructor.newInstance(serialized));
return;
} else { } else {
typeObj = chatMessageTypes == null ? nmsChatMessageTypeClassValueOf.invoke(null, String.valueOf(type)) : chatMessageTypes[type]; typeObj = chatMessageTypes == null ? nmsChatMessageTypeClassValueOf.invoke(null, String.valueOf(type)) : chatMessageTypes[type];
} }
} }
sendPacket.invoke(connection, packetTypeConstructor.newInstance(serialized, typeObj)); sendPacket.invoke(connection, packetTypeConstructor.newInstance(serialized,typeObj));
} catch (Exception ex) { } catch (Exception ex) {
Log.d("Json发包错误 " + version, ex); Log.d("Json发包错误 " + version, ex);
} }