aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Linfoot <connorlinfoot@me.com>2024-06-16 19:05:54 +0100
committerGitHub <noreply@github.com>2024-06-16 19:05:54 +0100
commit1fb88d12548e11fc3fea05f1fc3b280683fdd8a7 (patch)
treeab28e0b8ade8e095dbe94fa6a031b12e07dce5d4
parent33d8531456946dc97b3b1d9e890c018ae1ca402b (diff)
downloadHyPixelForgeModAPI-1fb88d12548e11fc3fea05f1fc3b280683fdd8a7.tar.gz
HyPixelForgeModAPI-1fb88d12548e11fc3fea05f1fc3b280683fdd8a7.tar.bz2
HyPixelForgeModAPI-1fb88d12548e11fc3fea05f1fc3b280683fdd8a7.zip
fix: Handle incoming packets on the main thread (#3)
-rw-r--r--src/main/java/net/hypixel/modapi/forge/ForgeModAPI.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main/java/net/hypixel/modapi/forge/ForgeModAPI.java b/src/main/java/net/hypixel/modapi/forge/ForgeModAPI.java
index 16a75ef..1a15da3 100644
--- a/src/main/java/net/hypixel/modapi/forge/ForgeModAPI.java
+++ b/src/main/java/net/hypixel/modapi/forge/ForgeModAPI.java
@@ -86,11 +86,13 @@ public class ForgeModAPI {
return;
}
- try {
- HypixelModAPI.getInstance().handle(identifier, new PacketSerializer(packet.getBufferData()));
- } catch (Exception e) {
- LOGGER.log(Level.WARNING, "Failed to handle packet " + identifier, e);
- }
+ Minecraft.getMinecraft().addScheduledTask(() -> {
+ try {
+ HypixelModAPI.getInstance().handle(identifier, new PacketSerializer(packet.getBufferData()));
+ } catch (Exception e) {
+ LOGGER.log(Level.WARNING, "Failed to handle packet " + identifier, e);
+ }
+ });
}
}
}