mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-30 22:53:26 +01:00
Don't pass our CaptureInputStream to the "get player identity" function
This commit is contained in:
parent
a31dc6fdcb
commit
7f69c41bf6
@ -19,7 +19,6 @@ 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;
|
||||
|
||||
@ -91,15 +90,16 @@ class ReadPacketModifier implements MethodInterceptor {
|
||||
Object overridenObject = override.get(thisObj);
|
||||
Object returnValue = null;
|
||||
|
||||
// We need this in order to get the correct player
|
||||
DataInputStream input = isReadPacketDataMethod ? (DataInputStream) args[0] : null;
|
||||
ByteArrayOutputStream bufferStream = null;
|
||||
|
||||
// See if we need to buffer the read data
|
||||
if (isReadPacketDataMethod && packetInjector.requireInputBuffers(packetID)) {
|
||||
CaptureInputStream captured = new CaptureInputStream(
|
||||
(InputStream) args[0],
|
||||
bufferStream = new ByteArrayOutputStream());
|
||||
input, bufferStream = new ByteArrayOutputStream());
|
||||
|
||||
// Stash it back
|
||||
// Swap it with our custom stream
|
||||
args[0] = new DataInputStream(captured);
|
||||
}
|
||||
|
||||
@ -120,9 +120,10 @@ class ReadPacketModifier implements MethodInterceptor {
|
||||
|
||||
// Is this a readPacketData method?
|
||||
if (isReadPacketDataMethod) {
|
||||
// Swap back custom stream
|
||||
args[0] = input;
|
||||
|
||||
try {
|
||||
// We need this in order to get the correct player
|
||||
DataInputStream input = (DataInputStream) args[0];
|
||||
byte[] buffer = bufferStream != null ? bufferStream.toByteArray() : null;
|
||||
|
||||
// Let the people know
|
||||
|
Loading…
Reference in New Issue
Block a user