mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-24 11:36:51 +01:00
Find the correct send packet method.
This commit is contained in:
parent
7afc930592
commit
f5e519eada
@ -41,10 +41,17 @@ public class MinecraftMethods {
|
|||||||
public static Method getSendPacketMethod() {
|
public static Method getSendPacketMethod() {
|
||||||
if (sendPacketMethod == null) {
|
if (sendPacketMethod == null) {
|
||||||
Class<?> serverHandlerClass = MinecraftReflection.getNetServerHandlerClass();
|
Class<?> serverHandlerClass = MinecraftReflection.getNetServerHandlerClass();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sendPacketMethod = FuzzyReflection.fromObject(serverHandlerClass).getMethodByName("sendPacket.*");
|
sendPacketMethod = FuzzyReflection.fromClass(serverHandlerClass).getMethodByName("sendPacket.*");
|
||||||
} catch (IllegalArgumentException e) {
|
} 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<String, Method> netServer = getMethodList(
|
Map<String, Method> netServer = getMethodList(
|
||||||
serverHandlerClass, MinecraftReflection.getPacketClass());
|
serverHandlerClass, MinecraftReflection.getPacketClass());
|
||||||
Map<String, Method> netHandler = getMethodList(
|
Map<String, Method> netHandler = getMethodList(
|
||||||
|
Loading…
Reference in New Issue
Block a user