Skip to content

ViaVersion compatibility #1053

@kennytv

Description

@kennytv

Title: Server changes needed to support Via

ViaVersion has a similar effect to ProtocolSupport, but in the other direction - it allows players to connect with a higher client version than the actual server (there is also ViaBackwards and Rewind, which go backwards, but their compat goes hand in hand with ViaVersion).

I was a little bored and played around with Glowstone and Via and actually got it to fully work, but encountered one problem when doing that:
The CodecsHandler is an always changing object, which'd mean Via would have to inject its own handler every single time (without going some absurder routs).
The way I hackily adapted the server for testing purposes was to let it find its protocol itself (https://kennytv.eu/files/bdyfi.png) in a single handler, so that the instance is never replaced.

Probably not needed to be looked at, but here's the custom codecshandler, most of its code is just reused from he other platforms: https://github.com/KennyTV/ViaVersion/blob/glowstone/glowstone/src/main/java/us/myles/ViaVersion/glowstone/handlers/GlowstoneCodecHandler.java
(I also made the CodecsHandler non-final to avoid reflection usage on en-/decoding, but that's not really necessary)

Eitherway, there might be an easy way to circumvent this I just dont know about, but I just wanted to throw this in here.

EDIT: right I totally forgot another thing - since Via already shades its Bukkit and Sponge parts, there needs to be some sort of glowstone.yml that is prioritized over the other ones to actually load. While we could make a common class for Bukkit and Glowstone, that'd go against its current structure.

TL;DR the CodecsHandler instance either has to stay the same or we need a way to instantly reinject new instances/functions during en-/decode + a glowstone.yml that is prioritized over Bukkit's and Sponge's plugin files.

I'm honestly unsure what the best way of handling this would be (since I'm also one of the "newer" Via contributors that haven't been around for too long to know that kind of injecting trickery), but that's why I'm creating this issue 👀

If changes are applicable, it'd be nice they could also be ported in both the 1.13 and 1.12 branches


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions