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:32:21 +00:00
commit fb88f45568
2 changed files with 19 additions and 16 deletions

3
.gitignore vendored
View File

@ -1,5 +1,8 @@
# Eclipse stuff # Eclipse stuff
/.settings /.settings
/.classpath
/.factorypath
/.project
# netbeans # netbeans
/nbproject /nbproject

View File

@ -158,18 +158,7 @@ public class C {
Object serialized = chatSerializer.invoke(null, json); Object serialized = chatSerializer.invoke(null, json);
Object player = getHandle.invoke(receivingPacket); Object player = getHandle.invoke(receivingPacket);
Object connection = playerConnection.get(player); Object connection = playerConnection.get(player);
Object typeObj; Object typeObj = chatMessageTypes == null ? nmsChatMessageTypeClassValueOf.invoke(null, String.valueOf(type)) : chatMessageTypes[type];
if(titlePAB){
sendPacket.invoke(connection,Title.packetTitleSendConstructor.newInstance(Title.actions[2],serialized));
return;
}else {
if (nmsChatMessageTypeClass==null) {
sendPacket.invoke(connection, packetTypeConstructor.newInstance(serialized));
return;
} else {
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);
@ -374,6 +363,7 @@ public class C {
private static Constructor<?> packetTitleSetTimeConstructor; private static Constructor<?> packetTitleSetTimeConstructor;
private static Object[] actions; private static Object[] actions;
static { static {
<<<<<<< HEAD
if(cauldron1710 &&uranium) { if(cauldron1710 &&uranium) {
try { try {
packetActions = Class.forName("cc.uraniummc.packet.S45PacketTitle$Type"); packetActions = Class.forName("cc.uraniummc.packet.S45PacketTitle$Type");
@ -403,6 +393,16 @@ public class C {
Log.w("Title 兼容性工具初始化失败 可能造成部分功能不可用!"); Log.w("Title 兼容性工具初始化失败 可能造成部分功能不可用!");
Log.d(ignore); Log.d(ignore);
} }
=======
try {
packetActions = Class.forName(a(newversion ? "PacketPlayOutTitle$EnumTitleAction" : "EnumTitleAction"));
packetTitle = Class.forName(a("PacketPlayOutTitle"));
packetTitleSendConstructor = packetTitle.getConstructor(packetActions, nmsIChatBaseComponent);
packetTitleSetTimeConstructor = packetTitle.getConstructor(packetActions, nmsIChatBaseComponent, Integer.TYPE, Integer.TYPE, Integer.TYPE);
actions = packetActions.getEnumConstants();
} catch (Exception ignore) {
Log.w("Title 兼容性工具初始化失败 可能造成部分功能不可用!");
>>>>>>> 1beb0e6de29041cca947b1821be642d5d91665e3
} }
} }
@ -473,7 +473,7 @@ public class C {
// Send timings first // Send timings first
Object player = getHandle.invoke(recoverPlayer); Object player = getHandle.invoke(recoverPlayer);
Object connection = playerConnection.get(player); Object connection = playerConnection.get(player);
Object packet = packetTitleSendConstructor.newInstance(titlePAB?actions[5]:actions[4], null); Object packet = packetTitleSendConstructor.newInstance(actions[4], null);
sendPacket.invoke(connection, packet); sendPacket.invoke(connection, packet);
} }
@ -520,7 +520,7 @@ public class C {
Object packet; Object packet;
// Send if set // Send if set
if ((fadeInTime != -1) && (fadeOutTime != -1) && (stayTime != -1)) { if ((fadeInTime != -1) && (fadeOutTime != -1) && (stayTime != -1)) {
packet = packetTitleSetTimeConstructor.newInstance(titlePAB?actions[3]:actions[2], null, fadeInTime * 20, stayTime * 20, fadeOutTime * 20); packet = packetTitleSetTimeConstructor.newInstance(actions[2], null, fadeInTime * 20, stayTime * 20, fadeOutTime * 20);
sendPacket.invoke(connection, packet); sendPacket.invoke(connection, packet);
} }
// Send title // Send title