diff --git a/pom.xml b/pom.xml index 26e23a1..dfb4b9e 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 pw.yumc YumCore - 1.9.2 + 1.9.3 ${project.artifactId} 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 5acf1cb..4b2ca6f 100644 --- a/src/main/java/pw/yumc/YumCore/bukkit/compatible/C.java +++ b/src/main/java/pw/yumc/YumCore/bukkit/compatible/C.java @@ -78,9 +78,13 @@ public class C { Class typePlayerConnection = subVersion < 17 ? Class.forName(a("PlayerConnection")) : Class.forName("net.minecraft.server.network.PlayerConnection"); getHandle = typeCraftPlayer.getMethod("getHandle"); playerConnection = subVersion < 17 ? typeNMSPlayer.getField("playerConnection") : typeNMSPlayer.getField("b"); - sendPacket = typePlayerConnection.getMethod("sendPacket", subVersion < 17 ? - Class.forName(a("Packet")) : - Class.forName("net.minecraft.network.protocol.Packet")); + if (subVersion < 17) { + sendPacket = typePlayerConnection.getMethod("sendPacket", Class.forName(a("Packet"))); + } else if (subVersion == 17) { + sendPacket = typePlayerConnection.getMethod("sendPacket", Class.forName("net.minecraft.network.protocol.Packet")); + } else { + sendPacket = typePlayerConnection.getMethod("a", Class.forName("net.minecraft.network.protocol.Packet")); + } init = true; } catch (Exception e) { Log.w("C 兼容性工具初始化失败 可能造成部分功能不可用!");