-
-
Notifications
You must be signed in to change notification settings - Fork 779
Refactor Velocity networking to be closer to vanilla #1672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev/3.0.0
Are you sure you want to change the base?
Conversation
proxy/src/main/java/com/velocitypowered/proxy/command/builtin/VelocityCommand.java
Outdated
Show resolved
Hide resolved
| public UUID getUuid() { | ||
| return uuid; | ||
| } | ||
|
|
||
| public int getAction() { | ||
| return action; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why keeping both getter types is necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the AI (Claude) wanted to make sure the code compiled and it sometimes chose to amend the existing code and sometimes add in getters. I didn't steer it in that direction.
Again, while it's redundant, it's a nit that someone else can fix.
| import org.checkerframework.checker.nullness.qual.Nullable; | ||
|
|
||
| public class DisconnectPacket implements MinecraftPacket { | ||
| public final class DisconnectPacket implements MinecraftPacket { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why some classes like this one aren't records? It has public constructor, all final fields and record style getters, so I can't think of a reason
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's worth converting every class to a record, it just wastes time. This feels like a very unimportant nit.
f572af1 to
f390682
Compare
| int expectedMinLen = packet.decodeExpectedMinLength(buf, direction, registry.version); | ||
| int expectedMaxLen = packet.decodeExpectedMaxLength(buf, direction, registry.version); | ||
| private void doLengthSanityChecks(ByteBuf buf, | ||
| com.velocitypowered.proxy.protocol.PacketCodec<? extends MinecraftPacket> codec) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the full name listed here?
This is a really large PR, so review carefully.
This PR refactors Velocity's internal networking to use immutable(-ish) packets and splits encoding/decoding into separate codecs. This refactor isn't fully complete but there's enough to start doing more work on this.