Welcome to the Hangar Open Beta. Please report any issue you encounter on GitHub!
Avatar for 4drian3d

Manage packets through Velocity's native events

Report VPacketEvents?

VPacketEvents

Discord

Manage packets through Velocity's native events

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 stuff
    }
    
    public void registerPacket() {
      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

  • Download VPacketEvents from Modrinth
  • Drag and drop on your plugins folder
  • Start the server

Dev Setup

Gradle

repositories {
    mavenCentral()
}
dependencies {
    compileOnly("io.github.4drian3d:vpacketevents-api:1.1.0")
}

Javadocs

https://javadoc.io/doc/io.github.4drian3d/vpacketevents-api

Information

CategoryDeveloper Tools
Published onMarch 4, 2023
LicenseGPL
Downloads94
Stars3
Watchers2
Library

Pinned Versions

Members