Velocity icon indicating copy to clipboard operation
Velocity copied to clipboard

An event even before protocol version is checked

Open scrayos opened this issue 1 year ago • 2 comments

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

scrayos avatar Jul 06 '24 07:07 scrayos

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 avatar Jul 06 '24 09:07 Nacioszeczek

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.

scrayos avatar Jul 06 '24 11:07 scrayos