feat: Implement versioning, use for gear sharing#16
Conversation
There was a problem hiding this comment.
Pull Request Overview
Implements versioning system for the Hades protocol to support gear sharing functionality. The PR adds version tracking to authentication packets and establishes a foundation for protocol compatibility management.
- Adds
HadesVersionenum withUNKNOWNandVERSION_0_6_1values - Modifies
HCPacketAuthenticateto include version field with backward compatibility - Implements optional version reading/writing in packet serialization
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| HadesVersion.java | New enum defining protocol versions including gear sharing support |
| HCPacketAuthenticate.java | Updated to include version field with backward-compatible serialization |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| @Override | ||
| public void writeData(HadesBuffer buffer) { | ||
| buffer.writeString(token); | ||
| buffer.writeEnum(version); |
There was a problem hiding this comment.
The writeData method always writes the version, but readData only reads it conditionally. This creates an asymmetric serialization pattern that could cause deserialization issues when version is null or when communicating with older clients that don't expect the version field.
| buffer.writeEnum(version); | |
| if (version != null && version != HadesVersion.UNKNOWN) { | |
| buffer.writeEnum(version); | |
| } |
| public HCPacketAuthenticate() { } | ||
|
|
||
| public HCPacketAuthenticate(String token) { | ||
| this.token = token; |
There was a problem hiding this comment.
The single-parameter constructor doesn't initialize the version field, leaving it null. This will cause a NullPointerException when writeData calls buffer.writeEnum(version) with a null value.
| this.token = token; | |
| this.token = token; | |
| this.version = HadesVersion.UNKNOWN; |
Wynntils PR: Wynntils/Wynntils#3589
HadesServer PR: https://github.com/Wynntils/HadesServer/pull/16