PaperMC / Velocity

The modern, next-generation Minecraft server proxy.
https://papermc.io/software/velocity
GNU General Public License v3.0
1.69k stars 593 forks source link

An event even before protocol version is checked #1374

Open scrayos opened 2 weeks ago

scrayos commented 2 weeks ago

Requested Feature

I'd like to have an event that is even triggered before the protocol version check here: https://github.com/PaperMC/Velocity/blob/5154f029108e3d3ba804b9d4555903347f2376c2/proxy/src/main/java/com/velocitypowered/proxy/connection/client/HandshakeSessionHandler.java#L127

Why is this needed?

So that incompatibilities in the protocol version can be checked within the plugin and handled accordingly. Currently, it is not possible to modify the message that is sent on a too recent protocol version within plugins. I'd like to specify an allowed range of versions and display a unified message on either too new versions or too old versions.

Alternative Solutions

Optionally, the check could be moved below the HandshakeEvent.

Additional Information

No response

Nacioszeczek commented 2 weeks ago

You can modify the message by overriding it in .properties files inside lang/. Unless you also want to modify the message based on whether the client is too old or too new - which still wouldn't warrant a new event - I'm going to close it.

scrayos commented 2 weeks ago

You can modify the message by overriding it in .properties files inside lang/. Unless you also want to modify the message based on whether the client is too old or too new - which still wouldn't warrant a new event - I'm going to close it.

@Nacioszeczek The advantage of an event would be that more dynamic solutions would be possible. We would be able to track those connection attempts with Prometheus (to see the demand), we could display different messages based on the specific version. We could (theoretically) circumvent the IP limiter for certain, authorized IP ranges and many additional things.

Just modifying the language bundle is not flexible enough, in my opinion.