Don't assume the InputStream is an DataInputStream in Spigot's case.
Dieser Commit ist enthalten in:
Ursprung
be9bbc924e
Commit
3f8a48732e
@ -19,6 +19,7 @@ package com.comphenix.protocol.injector.packet;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
@ -314,13 +315,13 @@ class ProxyPacketInjector implements PacketInjector {
|
||||
}
|
||||
|
||||
// Called from the ReadPacketModified monitor
|
||||
public PacketEvent packetRecieved(PacketContainer packet, DataInputStream input, byte[] buffered) {
|
||||
public PacketEvent packetRecieved(PacketContainer packet, InputStream input, byte[] buffered) {
|
||||
if (playerInjection.canRecievePackets()) {
|
||||
return playerInjection.handlePacketRecieved(packet, input, buffered);
|
||||
}
|
||||
|
||||
try {
|
||||
Player client = playerInjection.getPlayerByConnection(input);
|
||||
Player client = playerInjection.getPlayerByConnection((DataInputStream) input);
|
||||
|
||||
// Never invoke a event if we don't know where it's from
|
||||
if (client != null) {
|
||||
|
@ -19,6 +19,7 @@ package com.comphenix.protocol.injector.packet;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
|
||||
@ -102,7 +103,7 @@ class ReadPacketModifier implements MethodInterceptor {
|
||||
Object returnValue = null;
|
||||
|
||||
// We need this in order to get the correct player
|
||||
DataInputStream input = isReadPacketDataMethod ? (DataInputStream) args[0] : null;
|
||||
InputStream input = isReadPacketDataMethod ? (InputStream) args[0] : null;
|
||||
ByteArrayOutputStream bufferStream = null;
|
||||
|
||||
// See if we need to buffer the read data
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.comphenix.protocol.injector.player;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Set;
|
||||
@ -173,7 +174,7 @@ public interface PlayerInjectionHandler {
|
||||
* @param buffered - the buffered packet.
|
||||
* @return The packet event.
|
||||
*/
|
||||
public abstract PacketEvent handlePacketRecieved(PacketContainer packet, DataInputStream input, byte[] buffered);
|
||||
public abstract PacketEvent handlePacketRecieved(PacketContainer packet, InputStream input, byte[] buffered);
|
||||
|
||||
/**
|
||||
* Close any lingering proxy injections.
|
||||
|
@ -18,6 +18,7 @@
|
||||
package com.comphenix.protocol.injector.player;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.InetSocketAddress;
|
||||
@ -656,7 +657,7 @@ class ProxyPlayerInjectionHandler implements PlayerInjectionHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketEvent handlePacketRecieved(PacketContainer packet, DataInputStream input, byte[] buffered) {
|
||||
public PacketEvent handlePacketRecieved(PacketContainer packet, InputStream input, byte[] buffered) {
|
||||
throw new UnsupportedOperationException("Proxy injection cannot handle recieved packets.");
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.comphenix.protocol.injector.spigot;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Set;
|
||||
@ -102,7 +103,7 @@ class DummyPlayerHandler implements PlayerInjectionHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketEvent handlePacketRecieved(PacketContainer packet, DataInputStream input, byte[] buffered) {
|
||||
public PacketEvent handlePacketRecieved(PacketContainer packet, InputStream input, byte[] buffered) {
|
||||
// Associate this buffered data
|
||||
if (buffered != null) {
|
||||
injector.saveBuffered(packet.getHandle(), buffered);
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren