Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/4drian3d/vpacketevents
Manage packets through Velocity's native events
https://github.com/4drian3d/vpacketevents
api java minecraft-api minecraft-plugin velocity-plugin velocitypowered
Last synced: 3 months ago
JSON representation
Manage packets through Velocity's native events
- Host: GitHub
- URL: https://github.com/4drian3d/vpacketevents
- Owner: 4drian3d
- Created: 2023-02-21T03:17:50.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-23T17:51:47.000Z (3 months ago)
- Last Synced: 2024-10-24T02:05:07.232Z (3 months ago)
- Topics: api, java, minecraft-api, minecraft-plugin, velocity-plugin, velocitypowered
- Language: Java
- Homepage: https://modrinth.com/plugin/vpacketevents
- Size: 256 KB
- Stars: 16
- Watchers: 1
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# VPacketEvents
[![Discord](https://img.shields.io/discord/899740810956910683?color=7289da&label=Discord)](https://discord.gg/5NMMzK5mAn) ![](https://img.shields.io/maven-central/v/io.github.4drian3d/vpacketevents-api?style=flat-square)
Manage and register packets through Velocity's native events
```java
class PacketListener {
@Subscribe
public void onPacketReceive(PacketReceiveEvent event) {
final MinecraftPacket packet = event.getPacket();
if (packet instanceof KeyedPlayerCommand commandPacket) {
final String commandExecuted = commandPacket.getCommand();
event.setResult(GenericResult.denied());
}
}
@Subscribe
public void onPacketSend(PacketSendEvent event) {
final MinecraftPacket packet = event.getPacket();
if (packet instanceof ServerData serverData) {
// some stuff
final boolean isSecureChatEnforced = serverData.isSecureChatEnforced();
}
}
public void registerMyPacket() {
// 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
- Download VPacketEvents from Modrinth
- Drag and drop on your plugins folder
- Start the server## Dev Setup
### Gradle
```kotlin
repositories {
mavenCentral()
}dependencies {
compileOnly("io.github.4drian3d:vpacketevents-api:1.1.0")
}
```## Javadocs
https://javadoc.io/doc/io.github.4drian3d/vpacketevents-api