backport1.20.1 #6

Zusammengeführt
YoyoNow hat 54 Commits von backport1.20.1 nach master 2024-02-01 19:58:32 +01:00 zusammengeführt
Nur Änderungen aus Commit 93c618a150 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -26,10 +26,11 @@ public class AxiomBigPayloadHandler extends ByteToMessageDecoder {
@Override @Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
try { int i = in.readableBytes();
if (i != 0) {
int readerIndex = in.readerIndex(); int readerIndex = in.readerIndex();
int i = in.readableBytes(); boolean success = false;
if (i != 0) { try {
FriendlyByteBuf buf = new FriendlyByteBuf(in); FriendlyByteBuf buf = new FriendlyByteBuf(in);
int packetId = buf.readVarInt(); int packetId = buf.readVarInt();
@ -39,15 +40,18 @@ public class AxiomBigPayloadHandler extends ByteToMessageDecoder {
ServerPlayer player = connection.getPlayer(); ServerPlayer player = connection.getPlayer();
if (player != null && player.getBukkitEntity().hasPermission("axiom.*")) { if (player != null && player.getBukkitEntity().hasPermission("axiom.*")) {
if (listener.onReceive(player, buf)) { if (listener.onReceive(player, buf)) {
success = true;
return; return;
} }
} }
} }
} }
} catch (Throwable ignored) {
} finally {
if (!success) {
in.readerIndex(readerIndex);
}
} }
in.readerIndex(readerIndex);
} catch (Exception e) {
e.printStackTrace();
} }
ctx.fireChannelRead(in.retain()); ctx.fireChannelRead(in.retain());