Skip to content

hjrkgrngjirjngjrijgnjrjgnjrgrnjgjrgj/PacketWrapper

Repository files navigation

PacketWrapper

Build Javadoc GitHub ProtocolLib ProtocolLib

This version requires ProtocolLib 5.1.0 or later: https://github.com/dmulloy2/ProtocolLib/releases/tag/5.1.0

This is an unofficial continuation of PacketWrapper by dmulloy2 and aadnk. The original versions can be found here and here.

When reading and writing packets in ProtocolLib, it is necessary to know the order in which the fields are stored in memory. This requires you to decompile the Minecraft source code with JD-GUI or find it in the Spigot work directory (/work/decompile/), while decoding the meaning of a field by looking up an online wiki resource (tutorial). It would be much easier if these packets could be accessed as any other normal Java bean.

Enter PacketWrapper. It contains wrapper classes for all known packets in 1.20, providing you with access to the fields by name, along with automatic conversion to existing Bukkit enumerations and classes. It also includes a number of custom enumerations when appropriate.

How to use

Maven:

First add my repository to your pom.xml so Maven can find the library.

<repositories>
    <repository>
        <id>lukasalt-repo</id>
        <url>https://repo.lukasa.lt/repository/maven-public/</url>
    </repository>
</repositories>

Then register the dependency in your pom.xml. If you prefer to install PacketWrapper as a plugin on the server, set <scope>static</scope>.

<dependencies>
    <dependency>
        <groupId>com.comphenix.packetwrapper</groupId>
        <artifactId>PacketWrapper</artifactId>
        <version>1.20-2.2.1</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

Either install PacketWrapper as a plugin or shade it into your plugin. Alternatively, you can copy just the required classes (AbstractPacket and the Wrappers you are using) directly to your project.

Gradle (build.gradle):

First register the jitpack repository in your build.gradle:

repositories {
    ...
    maven { url 'https://repo.lukasa.lt/repository/maven-public/' }
}

Then add the actual dependency:

dependencies {
    ...
    compile 'com.comphenix.packetwrapper:PacketWrapper:1.20-2.2.1'
}

Either install PacketWrapper as a plugin on the server or shadow it into your plugin. Alternatively, you can copy just the required classes (AbstractPacket and the Wrappers you are using) directly to your project.

Older Versions

Dependencies

Resources

Building

You can compile this project yourself by using the latest version of Maven using mvn clean install.

Remarks

This project was mostly generated by a script.