mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2025-02-10 08:41:26 +01:00
Revert "The bytebuf doesn't need to be rewritten"
This reverts commit ac877d0b1a
.
This commit is contained in:
parent
f04a748e54
commit
50bfc86706
@ -31,12 +31,15 @@ public class BukkitDecodeHandler extends ByteToMessageDecoder {
|
|||||||
throw CancelDecoderException.generate(null);
|
throw CancelDecoderException.generate(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ByteBuf transformedBuf = null;
|
||||||
|
try {
|
||||||
if (info.shouldTransformPacket()) {
|
if (info.shouldTransformPacket()) {
|
||||||
info.transformIncoming(bytebuf, CancelDecoderException::generate);
|
transformedBuf = ctx.alloc().buffer().writeBytes(bytebuf);
|
||||||
|
info.transformIncoming(transformedBuf, CancelDecoderException::generate);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
list.addAll(PipelineUtil.callDecode(this.minecraftDecoder, ctx, bytebuf));
|
list.addAll(PipelineUtil.callDecode(this.minecraftDecoder, ctx, transformedBuf == null ? bytebuf : transformedBuf));
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
if (e.getCause() instanceof Exception) {
|
if (e.getCause() instanceof Exception) {
|
||||||
throw (Exception) e.getCause();
|
throw (Exception) e.getCause();
|
||||||
@ -44,6 +47,11 @@ public class BukkitDecodeHandler extends ByteToMessageDecoder {
|
|||||||
throw (Error) e.getCause();
|
throw (Error) e.getCause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
if (transformedBuf != null) {
|
||||||
|
transformedBuf.release();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -28,12 +28,15 @@ public class SpongeDecodeHandler extends ByteToMessageDecoder {
|
|||||||
throw CancelDecoderException.generate(null);
|
throw CancelDecoderException.generate(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ByteBuf transformedBuf = null;
|
||||||
|
try {
|
||||||
if (info.shouldTransformPacket()) {
|
if (info.shouldTransformPacket()) {
|
||||||
info.transformIncoming(bytebuf, CancelDecoderException::generate);
|
transformedBuf = ctx.alloc().buffer().writeBytes(bytebuf);
|
||||||
|
info.transformIncoming(transformedBuf, CancelDecoderException::generate);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
list.addAll(PipelineUtil.callDecode(this.minecraftDecoder, ctx, bytebuf));
|
list.addAll(PipelineUtil.callDecode(this.minecraftDecoder, ctx, transformedBuf == null ? bytebuf : transformedBuf));
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
if (e.getCause() instanceof Exception) {
|
if (e.getCause() instanceof Exception) {
|
||||||
throw (Exception) e.getCause();
|
throw (Exception) e.getCause();
|
||||||
@ -41,6 +44,11 @@ public class SpongeDecodeHandler extends ByteToMessageDecoder {
|
|||||||
throw (Error) e.getCause();
|
throw (Error) e.getCause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
if (transformedBuf != null) {
|
||||||
|
transformedBuf.release();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user