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.ByteArrayOutputStream;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -91,15 +90,16 @@ class ReadPacketModifier implements MethodInterceptor {
|
|||||||
Object overridenObject = override.get(thisObj);
|
Object overridenObject = override.get(thisObj);
|
||||||
Object returnValue = null;
|
Object returnValue = null;
|
||||||
|
|
||||||
|
// We need this in order to get the correct player
|
||||||
|
DataInputStream input = isReadPacketDataMethod ? (DataInputStream) args[0] : null;
|
||||||
ByteArrayOutputStream bufferStream = null;
|
ByteArrayOutputStream bufferStream = null;
|
||||||
|
|
||||||
// See if we need to buffer the read data
|
// See if we need to buffer the read data
|
||||||
if (isReadPacketDataMethod && packetInjector.requireInputBuffers(packetID)) {
|
if (isReadPacketDataMethod && packetInjector.requireInputBuffers(packetID)) {
|
||||||
CaptureInputStream captured = new CaptureInputStream(
|
CaptureInputStream captured = new CaptureInputStream(
|
||||||
(InputStream) args[0],
|
input, bufferStream = new ByteArrayOutputStream());
|
||||||
bufferStream = new ByteArrayOutputStream());
|
|
||||||
|
|
||||||
// Stash it back
|
// Swap it with our custom stream
|
||||||
args[0] = new DataInputStream(captured);
|
args[0] = new DataInputStream(captured);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,9 +120,10 @@ class ReadPacketModifier implements MethodInterceptor {
|
|||||||
|
|
||||||
// Is this a readPacketData method?
|
// Is this a readPacketData method?
|
||||||
if (isReadPacketDataMethod) {
|
if (isReadPacketDataMethod) {
|
||||||
|
// Swap back custom stream
|
||||||
|
args[0] = input;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// We need this in order to get the correct player
|
|
||||||
DataInputStream input = (DataInputStream) args[0];
|
|
||||||
byte[] buffer = bufferStream != null ? bufferStream.toByteArray() : null;
|
byte[] buffer = bufferStream != null ? bufferStream.toByteArray() : null;
|
||||||
|
|
||||||
// Let the people know
|
// Let the people know
|
||||||
|
Loading…
Reference in New Issue
Block a user