PacketEvents is a protocol library tailored to Minecraft Java Edition, designed to facilitate the processing and transmission of packets.
Official PacketEvents example repository.
A minimal, custom implementation of a 1.18.1 vanilla-compatible Minecraft server using PacketEvents.