Packet Events
Learn more about the Packet events OneConfig has to offer
SendPacketEvent
@Subscribe
public void onPacketSend(SendPacketEvent event) {
// check if the packet is the right type
if(event.packet instanceof S0FPacketSpawnMob) {
// cast the packet to the right type
S0FPacketSpawnMob packet = (S0FPacketSpawnMob) event.packet;
// do something with it
System.out.println("Entity attempted to be spawned with ID: " + packet.getEntityID());
// cancel the event afterwards, rendering this packet useless.
event.isCancelled = true;
}
}ReceivePacketEvent
Last updated
Was this helpful?