From f5e519eadae5371626d45dd112dca14334bb7dac Mon Sep 17 00:00:00 2001 From: "Kristian S. Stangeland" Date: Thu, 5 Dec 2013 08:08:13 +0100 Subject: [PATCH] Find the correct send packet method. --- .../comphenix/protocol/utility/MinecraftMethods.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftMethods.java b/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftMethods.java index ad179409..b1d7fef2 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftMethods.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftMethods.java @@ -41,10 +41,17 @@ public class MinecraftMethods { public static Method getSendPacketMethod() { if (sendPacketMethod == null) { Class serverHandlerClass = MinecraftReflection.getNetServerHandlerClass(); - + try { - sendPacketMethod = FuzzyReflection.fromObject(serverHandlerClass).getMethodByName("sendPacket.*"); + sendPacketMethod = FuzzyReflection.fromClass(serverHandlerClass).getMethodByName("sendPacket.*"); } catch (IllegalArgumentException e) { + // We can't use the method below on Netty + if (MinecraftReflection.isUsingNetty()) { + sendPacketMethod = FuzzyReflection.fromClass(serverHandlerClass). + getMethodByParameters("sendPacket", MinecraftReflection.getPacketClass()); + return sendPacketMethod; + } + Map netServer = getMethodList( serverHandlerClass, MinecraftReflection.getPacketClass()); Map netHandler = getMethodList(