aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/net/hypixel/modapi/forge/ForgeModAPI.java6
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();
}
});
}