2
2
3
3
import java .lang .reflect .InvocationTargetException ;
4
4
import java .lang .reflect .Method ;
5
+ import java .lang .reflect .Modifier ;
5
6
import java .util .List ;
6
7
import java .util .Map ;
7
8
12
13
13
14
import io .netty .buffer .Unpooled ;
14
15
import io .netty .channel .ChannelHandlerContext ;
15
- import io .netty .util .concurrent .GenericFutureListener ;
16
16
17
17
import net .sf .cglib .proxy .Enhancer ;
18
18
import net .sf .cglib .proxy .MethodInterceptor ;
@@ -85,7 +85,7 @@ public static Method getSendPacketMethod() {
85
85
* @param playerConnection - the player connection.
86
86
* @return The
87
87
*/
88
- public static Method getDisconnectMethod (Class <? extends Object > playerConnection ) {
88
+ public static Method getDisconnectMethod (Class <?> playerConnection ) {
89
89
try {
90
90
return FuzzyReflection .fromClass (playerConnection ).getMethodByName ("disconnect.*" );
91
91
} catch (IllegalArgumentException e ) {
@@ -95,7 +95,7 @@ public static Method getDisconnectMethod(Class<? extends Object> playerConnectio
95
95
}
96
96
97
97
/**
98
- * Retrieve the handle(Packet, GenericFutureListener[]) method of network manager.
98
+ * Retrieve the handle/send packet method of network manager.
99
99
* <p>
100
100
* This only exists in version 1.7.2 and above.
101
101
* @return The handle method.
@@ -104,15 +104,20 @@ public static Method getNetworkManagerHandleMethod() {
104
104
if (networkManagerHandle == null ) {
105
105
networkManagerHandle = FuzzyReflection
106
106
.fromClass (MinecraftReflection .getNetworkManagerClass (), true )
107
- .getMethodByParameters ("handle" , MinecraftReflection .getPacketClass ());
107
+ .getMethod (FuzzyMethodContract .newBuilder ()
108
+ .banModifier (Modifier .STATIC )
109
+ .returnTypeVoid ()
110
+ .parameterCount (1 )
111
+ .parameterExactType (MinecraftReflection .getPacketClass ())
112
+ .build ());
108
113
networkManagerHandle .setAccessible (true );
109
114
}
110
115
111
116
return networkManagerHandle ;
112
117
}
113
118
114
119
/**
115
- * Retrieve the packetRead(ChannelHandlerContext, Packet) method of NetworkMananger .
120
+ * Retrieve the packetRead(ChannelHandlerContext, Packet) method of NetworkManager .
116
121
* <p>
117
122
* This only exists in version 1.7.2 and above.
118
123
* @return The packetRead method.
0 commit comments