|
| 1 | +Contributing to ProtocolLib |
| 2 | +=========================== |
| 3 | +This page will detail specific things that must be done if you intend to contribute to this project. |
| 4 | + |
| 5 | +## Updating ProtocolLib to a New Protocol Version |
| 6 | +#### Before we get started: |
| 7 | +1. **When do we need to update the protocol version?** |
| 8 | + _A Minecraft protocol version is a number for each specification of the Minecraft protocol. |
| 9 | + This means it is incremented when there is a change to the [Protocol Specification](http://wiki.vg/Protocol), |
| 10 | + but not necessarily for each Minecraft version update. If the latest Minecraft version contains a protocol change, |
| 11 | + that means ProtocolLib needs to be updated._ |
| 12 | +2. **When do we need to update other parts of ProtocolLib?** |
| 13 | + _When the package version guard changes. The package version guard is the version string inserted |
| 14 | + into the package identifier for CraftBukkit and net.minecraft.server (e.g. v1_9_R2). It is incremented |
| 15 | + by Spigot if there is a major breaking change in the internal server code. This is to encourage plugins |
| 16 | + that interact directly with CraftBukkit/nms code to update more specifically. However, since most of |
| 17 | + ProtocolLib uses reflection, and the structure of packet classes is generally static, one will have |
| 18 | + to go through the code and change imports from nms/CraftBukkit._ |
| 19 | + |
| 20 | +#### Ready? Let's get started! |
| 21 | +1. Read the [Protocol Changes](http://wiki.vg/Protocol_History). Always make sure the list is both |
| 22 | +complete and correct. If you're unsure, don't hesitate to ask in #mcdevs (the people who maintain wiki.vg) on [freenode.net](http://freenode.net) |
| 23 | +or #spigot on [irc.spi.gt](http://irc.spi.gt) ([webchat](https://irc.spi.gt/iris/?channels=spigot)). |
| 24 | +2. Search for usages of the now-defunct NMS package guard and change them. |
| 25 | +3. The class `com.comphenix.protocol.PacketType` contains a list of all the packets. If any packets were added or removed |
| 26 | +(or had their ID changed), make sure to update this list. If a packet was removed |
| 27 | +in favor of usage of another packet, instead of removing it, move it to the bottom of the list |
| 28 | +in its section, add a deprecation warning to it, and redirect it to the packet that replaced it. |
| 29 | +4. `mvn` in the root directory to build the project. |
| 30 | +5. If tests fail in the maven build, go through the tests to make sure you removed references to any removed packets |
| 31 | +and changed the NMS version guards. |
| 32 | +6. Increment the package version in `com.comphenix.protocol.utility.Constants`. |
| 33 | +7. `com.comphenix.protocol.ProtocolLibrary` contains several constants that must be updated, including the Minecraft version |
| 34 | +and the release date. |
| 35 | +8. `com.comphenix.protocol.utility.MinecraftProtocolVersion` contains a map of all the protocol version integers. |
| 36 | +If the protocol version has been incremented, add a new line to the map. |
| 37 | +9. `mvn` in root directory again. If it builds successfully, test on the appropriate version of a Spigot server. If |
| 38 | +the build fails, debug! |
0 commit comments