3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-10-03 08:41:05 +02:00

Revert "The bytebuf doesn't need to be rewritten"

This reverts commit ac877d0b1a.
Dieser Commit ist enthalten in:
Myles 2021-02-09 16:32:31 +00:00
Ursprung f04a748e54
Commit 50bfc86706
2 geänderte Dateien mit 36 neuen und 20 gelöschten Zeilen

Datei anzeigen

@ -31,17 +31,25 @@ public class BukkitDecodeHandler extends ByteToMessageDecoder {
throw CancelDecoderException.generate(null);
}
if (info.shouldTransformPacket()) {
info.transformIncoming(bytebuf, CancelDecoderException::generate);
}
ByteBuf transformedBuf = null;
try {
list.addAll(PipelineUtil.callDecode(this.minecraftDecoder, ctx, bytebuf));
} catch (InvocationTargetException e) {
if (e.getCause() instanceof Exception) {
throw (Exception) e.getCause();
} else if (e.getCause() instanceof Error) {
throw (Error) e.getCause();
if (info.shouldTransformPacket()) {
transformedBuf = ctx.alloc().buffer().writeBytes(bytebuf);
info.transformIncoming(transformedBuf, CancelDecoderException::generate);
}
try {
list.addAll(PipelineUtil.callDecode(this.minecraftDecoder, ctx, transformedBuf == null ? bytebuf : transformedBuf));
} catch (InvocationTargetException e) {
if (e.getCause() instanceof Exception) {
throw (Exception) e.getCause();
} else if (e.getCause() instanceof Error) {
throw (Error) e.getCause();
}
}
} finally {
if (transformedBuf != null) {
transformedBuf.release();
}
}
}

Datei anzeigen

@ -28,17 +28,25 @@ public class SpongeDecodeHandler extends ByteToMessageDecoder {
throw CancelDecoderException.generate(null);
}
if (info.shouldTransformPacket()) {
info.transformIncoming(bytebuf, CancelDecoderException::generate);
}
ByteBuf transformedBuf = null;
try {
list.addAll(PipelineUtil.callDecode(this.minecraftDecoder, ctx, bytebuf));
} catch (InvocationTargetException e) {
if (e.getCause() instanceof Exception) {
throw (Exception) e.getCause();
} else if (e.getCause() instanceof Error) {
throw (Error) e.getCause();
if (info.shouldTransformPacket()) {
transformedBuf = ctx.alloc().buffer().writeBytes(bytebuf);
info.transformIncoming(transformedBuf, CancelDecoderException::generate);
}
try {
list.addAll(PipelineUtil.callDecode(this.minecraftDecoder, ctx, transformedBuf == null ? bytebuf : transformedBuf));
} catch (InvocationTargetException e) {
if (e.getCause() instanceof Exception) {
throw (Exception) e.getCause();
} else if (e.getCause() instanceof Error) {
throw (Error) e.getCause();
}
}
} finally {
if (transformedBuf != null) {
transformedBuf.release();
}
}
}