1414import com .comphenix .protocol .utility .MinecraftReflection ;
1515import com .comphenix .protocol .wrappers .WrappedChatComponent ;
1616
17- import io .netty .channel .ChannelHandlerContext ;
18-
1917/**
2018 * This class facilitates the invocation of methods on the current packet listener.
21- * It attempts to execute the <code>send</code>, <code>read</code>, and <code>disconnect</code>
22- * methods and, upon failure (either due to the absence of the method or the packet
23- * listener being of an incorrect type), it delegates the call to the network manager.
19+ * It attempts to execute the <code>send</code>, and <code>disconnect</code> methods, upon failure
20+ * (either due to the absence of the method or the packet listener being of an incorrect type),
21+ * it delegates the call to the network manager.
2422 *
2523 * <p>Supported packet listener types include CONFIGURATION and PLAY. If the packet
2624 * listener does not match these types, or if the required method is missing, the
@@ -43,7 +41,6 @@ public class PacketListenerInvoker {
4341 private static final boolean DOES_PACKET_LISTENER_DISCONNECT_USE_COMPONENT = doesPacketListenerDisconnectUseComponent ();
4442
4543 private static final MethodAccessor NETWORK_MANAGER_SEND = getNetworkManagerSend ();
46- private static final MethodAccessor NETWORK_MANAGER_READ = getNetworkManagerRead ();
4744 private static final MethodAccessor NETWORK_MANAGER_DISCONNECT = getNetworkManagerDisconnect ();
4845 private static final MethodAccessor NETWORK_MANAGER_PACKET_LISTENER = getNetworkManagerPacketListener ();
4946
@@ -117,15 +114,6 @@ private static MethodAccessor getNetworkManagerSend() {
117114 return Accessors .getMethodAccessor (send );
118115 }
119116
120- private static MethodAccessor getNetworkManagerRead () {
121- FuzzyReflection networkManager = FuzzyReflection .fromClass (MinecraftReflection .getNetworkManagerClass (), true );
122-
123- Method read = networkManager
124- .getMethodByParameters ("read" , ChannelHandlerContext .class , MinecraftReflection .getPacketClass ());
125-
126- return Accessors .getMethodAccessor (read );
127- }
128-
129117 private static MethodAccessor getNetworkManagerDisconnect () {
130118 FuzzyReflection networkManager = FuzzyReflection .fromClass (MinecraftReflection .getNetworkManagerClass ());
131119
@@ -190,7 +178,7 @@ private Object getPacketListener() {
190178 }
191179
192180 /**
193- * Sends a packet using the current packet listener if available and valid; otherwise,
181+ * Sends a packet using the current packet listener if available and valid; otherwise,
194182 * falls back to the network manager.
195183 *
196184 * @param packet The packet to be sent.
@@ -204,15 +192,6 @@ public void send(Object packet) {
204192 }
205193 }
206194
207- /**
208- * Reads a packet directly using the network manager.
209- *
210- * @param packet The packet to be read.
211- */
212- public void read (Object packet ) {
213- NETWORK_MANAGER_READ .invoke (this .networkManager , null , packet );
214- }
215-
216195 /**
217196 * Disconnects the player using the current packet listener if available and valid; otherwise,
218197 * falls back to the network manager.
0 commit comments