-
Notifications
You must be signed in to change notification settings - Fork 0
Events
Packets sent & received by the server can be listened to using packet events
Clientbound packets are packets sent from the server to a connected client. You can listen to them using the following:
on packet interact entity packet receive netty processed:
cancel packetServerbound packets are packets that are sent from the client to the server. You can listen to them using the following:
on packet chunk data packet send netty processed:
cancel packetPackets can be processed on 3 different type of threads.
Netty threads are the threads that process all sent or received packets. Unlike other threads, these threads allow you to cancel or modify the packets. This is because the packets would've otherwise been processed by the server and thus can't be canceled or modified. Long Netty processing will increase player ping.
Async threads are an asynchronous thread relative to the main server thread which Minecraft operates on. These are useful for heavy computations and won't impact the main thread.
The Sync thread is the main Minecraft thread. It's where the majority of Minecraft runs on. Long sync processing will lag the server.
Caution
Minecraft is mostly NOT thread safe and thus you can only access Minecraft related things if the packet is processed on the sync thread. It is not possible to check Minecraft things and then cancel or alter the packet.
The guide was written by 3add and AmazinAxel