
VPacketEvents
Library for packet management through Velocity's native events
This mod provides developers with a convenient toolkit for managing and registering network packets in the Velocity environment. With it, you can easily intercept and process incoming and outgoing packets using the platform's standard event system.
Main Features
The library allows registering handlers for various packet types and Minecraft versions. You can block unwanted commands, modify transmitted data, or add your own network traffic processing logic.
class PacketListener {
@Subscribe
public void onPacketReceive(PacketReceiveEvent event) {
final MinecraftPacket packet = event.getPacket();
if (packet instanceof KeyedPlayerCommand commandPacket) {
event.setResult(GenericResult.denied());
}
}
@Subscribe
public void onPacketSend(PacketSendEvent event) {
// some logic
}
public void registerPacket() {
// UpdateTeamsPacket registration
PacketRegistration.of(UpdateTeamsPacket.class)
.direction(Direction.CLIENTBOUND)
.packetSupplier(UpdateTeamsPacket::new)
.stateRegistry(StateRegistry.PLAY)
.mapping(0x47, MINECRAFT_1_13, false)
.mapping(0x4B, MINECRAFT_1_14, false)
.mapping(0x4C, MINECRAFT_1_15, false)
.mapping(0x55, MINECRAFT_1_17, false)
.mapping(0x58, MINECRAFT_1_19_1, false)
.mapping(0x56, MINECRAFT_1_19_3, false)
.mapping(0x5A, MINECRAFT_1_19_4, false)
.register();
}
}
Installation
The installation process is extremely simple: download the mod file and place it in your server's plugins folder, then restart the server.
Developer Setup
Gradle
repositories {
mavenCentral()
}
dependencies {
compileOnly("io.github.4drian3d:vpacketevents-api:1.1.0")
}
Documentation
Complete API documentation is available via the standard Javadoc link.