From 032f2ff2287866c390e463d271481dd0fffac2d9 Mon Sep 17 00:00:00 2001 From: booky10 Date: Sat, 21 Sep 2024 16:25:19 +0200 Subject: [PATCH 1/3] Use proper logging for bungee instead of stdout --- .../packetevents/bungee/factory/BungeePacketEventsBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bungeecord/src/main/java/io/github/retrooper/packetevents/bungee/factory/BungeePacketEventsBuilder.java b/bungeecord/src/main/java/io/github/retrooper/packetevents/bungee/factory/BungeePacketEventsBuilder.java index 689b1d1f8..2fe01abed 100644 --- a/bungeecord/src/main/java/io/github/retrooper/packetevents/bungee/factory/BungeePacketEventsBuilder.java +++ b/bungeecord/src/main/java/io/github/retrooper/packetevents/bungee/factory/BungeePacketEventsBuilder.java @@ -178,7 +178,7 @@ public User getUser(@NotNull Object player) { protected void log(Level level, @Nullable NamedTextColor color, String message) { // First we must strip away the color codes that might be in this message message = STRIP_COLOR_PATTERN.matcher(message).replaceAll(""); - System.out.println(message); + ProxyServer.getInstance().getLogger().info(message); // TODO: Remove "[com.github.retrooper.packetevents.PacketEventsAPI]:" From logger // PacketEvents.getAPI().getLogger().log(level, color != null ? (color.toString()) : "" + message); } From 873589bd7fb9eca737f6ef74928083f0464918c8 Mon Sep 17 00:00:00 2001 From: booky10 Date: Sat, 21 Sep 2024 16:25:47 +0200 Subject: [PATCH 2/3] Clear recyclable out list after usage --- .../retrooper/packetevents/handlers/PacketEventsEncoder.java | 1 + 1 file changed, 1 insertion(+) diff --git a/bungeecord/src/main/java/io/github/retrooper/packetevents/handlers/PacketEventsEncoder.java b/bungeecord/src/main/java/io/github/retrooper/packetevents/handlers/PacketEventsEncoder.java index 39c1c1bc9..4d83f59fa 100644 --- a/bungeecord/src/main/java/io/github/retrooper/packetevents/handlers/PacketEventsEncoder.java +++ b/bungeecord/src/main/java/io/github/retrooper/packetevents/handlers/PacketEventsEncoder.java @@ -162,6 +162,7 @@ private void recompress(ChannelHandlerContext ctx, ByteBuf buffer, ChannelPromis } catch (InvocationTargetException exception) { throw new EncoderException("Error while recompressing bytebuf " + buffer.readableBytes(), exception); } finally { + out.clear(); outWrapper.handle.recycle(outWrapper); } } From d61c6900756a072302db08c2b8f784888d8c1c19 Mon Sep 17 00:00:00 2001 From: booky10 Date: Sat, 21 Sep 2024 16:26:01 +0200 Subject: [PATCH 3/3] Release buffers after recompression --- .../retrooper/packetevents/handlers/PacketEventsEncoder.java | 1 + 1 file changed, 1 insertion(+) diff --git a/bungeecord/src/main/java/io/github/retrooper/packetevents/handlers/PacketEventsEncoder.java b/bungeecord/src/main/java/io/github/retrooper/packetevents/handlers/PacketEventsEncoder.java index 4d83f59fa..a9250dab0 100644 --- a/bungeecord/src/main/java/io/github/retrooper/packetevents/handlers/PacketEventsEncoder.java +++ b/bungeecord/src/main/java/io/github/retrooper/packetevents/handlers/PacketEventsEncoder.java @@ -164,6 +164,7 @@ private void recompress(ChannelHandlerContext ctx, ByteBuf buffer, ChannelPromis } finally { out.clear(); outWrapper.handle.recycle(outWrapper); + buffer.release(); } }