From 15fa621147cda5b944c1c11e604610b7e05de524 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Wed, 13 Sep 2023 20:48:18 +0200 Subject: [PATCH] Fix handler of unknown axiom channels --- src/main/java/com/moulberry/axiom/buffer/MojBuf.java | 2 +- .../com/moulberry/axiom/packet/AxiomBigPayloadHandler.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/moulberry/axiom/buffer/MojBuf.java b/src/main/java/com/moulberry/axiom/buffer/MojBuf.java index 5d077b9..ad4c60b 100644 --- a/src/main/java/com/moulberry/axiom/buffer/MojBuf.java +++ b/src/main/java/com/moulberry/axiom/buffer/MojBuf.java @@ -17,7 +17,7 @@ public class MojBuf { private MojBuf() {} public static ByteBuf unpooled() { - return new FriendlyByteBuf(Unpooled.buffer(256, Integer.MAX_VALUE)); + return new FriendlyByteBuf(Unpooled.buffer()); } private static final Reflection.Method readUtf = Reflection.getTypedMethod(FriendlyByteBuf.class, String.class, int.class); diff --git a/src/main/java/com/moulberry/axiom/packet/AxiomBigPayloadHandler.java b/src/main/java/com/moulberry/axiom/packet/AxiomBigPayloadHandler.java index 0304d62..e493835 100644 --- a/src/main/java/com/moulberry/axiom/packet/AxiomBigPayloadHandler.java +++ b/src/main/java/com/moulberry/axiom/packet/AxiomBigPayloadHandler.java @@ -93,7 +93,9 @@ public class AxiomBigPayloadHandler extends ChannelInboundHandlerAdapter { } for(QueuedPacket packet : queue) { - AxiomPaper.getListener(packet.name).onMessage(player, packet.in); + AxiomPacketListener handler = AxiomPaper.getListener(packet.name); + if(handler != null) + handler.onMessage(player, packet.in); packet.in.release(); } }