Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-04 23:30:24 +01:00
The bytebuf doesn't need to be rewritten
Dieser Commit ist enthalten in:
Ursprung
37d57af6ec
Commit
ac877d0b1a
@ -31,25 +31,17 @@ public class BukkitDecodeHandler extends ByteToMessageDecoder {
|
||||
throw CancelDecoderException.generate(null);
|
||||
}
|
||||
|
||||
ByteBuf transformedBuf = null;
|
||||
try {
|
||||
if (info.shouldTransformPacket()) {
|
||||
transformedBuf = ctx.alloc().buffer().writeBytes(bytebuf);
|
||||
info.transformIncoming(transformedBuf, CancelDecoderException::generate);
|
||||
}
|
||||
if (info.shouldTransformPacket()) {
|
||||
info.transformIncoming(bytebuf, 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();
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,25 +28,17 @@ public class SpongeDecodeHandler extends ByteToMessageDecoder {
|
||||
throw CancelDecoderException.generate(null);
|
||||
}
|
||||
|
||||
ByteBuf transformedBuf = null;
|
||||
try {
|
||||
if (info.shouldTransformPacket()) {
|
||||
transformedBuf = ctx.alloc().buffer().writeBytes(bytebuf);
|
||||
info.transformIncoming(transformedBuf, CancelDecoderException::generate);
|
||||
}
|
||||
if (info.shouldTransformPacket()) {
|
||||
info.transformIncoming(bytebuf, 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();
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren