diff options
Diffstat (limited to 'src/main/java/net/hypixel/modapi/forge')
-rw-r--r-- | src/main/java/net/hypixel/modapi/forge/ForgeModAPI.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/net/hypixel/modapi/forge/ForgeModAPI.java b/src/main/java/net/hypixel/modapi/forge/ForgeModAPI.java index 12ce3ef..9b8777c 100644 --- a/src/main/java/net/hypixel/modapi/forge/ForgeModAPI.java +++ b/src/main/java/net/hypixel/modapi/forge/ForgeModAPI.java @@ -87,11 +87,15 @@ public class ForgeModAPI { return; } + PacketBuffer buffer = packet.getBufferData(); + buffer.retain(); Minecraft.getMinecraft().addScheduledTask(() -> { try { - HypixelModAPI.getInstance().handle(identifier, new PacketSerializer(packet.getBufferData())); + HypixelModAPI.getInstance().handle(identifier, new PacketSerializer(buffer)); } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to handle packet " + identifier, e); + } finally { + buffer.release(); } }); } |