Skip to content

Comments

Velocity fixes#227

Closed
oldium wants to merge 2 commits intoGeyserMC:masterfrom
oldium:fix/velocity-fixes
Closed

Velocity fixes#227
oldium wants to merge 2 commits intoGeyserMC:masterfrom
oldium:fix/velocity-fixes

Conversation

@oldium
Copy link

@oldium oldium commented Nov 21, 2021

Fixed few issues in Floodgate plugin when running on Velocity proxy:

  • Invalid data were sent when modern IP forwarding was enabled on Velocity proxy.
  • Wrong user name was provided in the PreLoginEvent - not the Floodgate one, but the one from the client's request.

The PreLoginEvent was fixed in the similar way as it is in the BungeeCord plugin support – it changes the user name property in the fired event instance itself. The UUID player part is already handled in the GameProfileRequestEvent handler, so this already works fine.

Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
String originalAddress;
String remaining;
if (isModernForwarding && addressFinished == -1) {
if (isModernForwarding || addressFinished == -1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused - why make this change?

Copy link
Author

@oldium oldium Nov 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if tries to prevent using -1 in a call to substring, but with && this is limited to only isModernForwarding, which is definitely wrong.

Changing this to || means to additionally force a different address format when Velocity with “modern” IP forwarding is used. It fixes error during connection (I will check again and write which exactly).

I verified that Velocity with “modern” IP forwarding is able to connect after this change. I have not checked what is really wrong with the packet format, but I can investigate it more.

I do not have Floodgate API running on the server, because the server is used also by Java clients at the same time and I do not need it. Anyway, I have more knowledge now, so I can investigate this more in depth. I have sources of Velocity, FastLogin and Floodgate, so I can check how it should really cooperate and if my fix is the right one.

@oldium
Copy link
Author

oldium commented Nov 24, 2021

I had a quick look at the issue and Velocity “modern” IP forwarding is not forwarding anything in the Server Address field of the HANDSHAKE packet. For player data forwarding (client IP, game profile) there is a separate velocity:player_info plugin channel. I will continue investigation on how it is expected that the Floodgate player data arrives into the server. Paper server in the Velocity mode currently skips parsing of the Server Address field (in Bungeecord mode it splits the Server Address by '\0'). I will check it more in detail later this week, I still do not know exactly why the changed if works.

@Camotoy
Copy link
Member

Camotoy commented Nov 24, 2021

It is my understanding that modern forwarding in Velocity works correctly, and there's been no regression that breaks it. So this is likely something specific to your setup?

@oldium
Copy link
Author

oldium commented Nov 25, 2021

Before I continue - just for my understanding. This is my scenario:

Bedrock Client → Geyser → Velocity[1] + Floodgate + FastLogin → PaperMC[1] + FastLogin + AdvancedLogin
Java Client → Velocity[2] + FastLogin → PaperMC[1] + FastLogin + AdvancedLogin

I have two Velocity proxies, one for Bedrock and one for Java clients, they distribute clients to the particular PaperMC instance by the server name in the HANDSHAKE request. Is it required that the Floodgate plugin runs also on the shared PaperMC server instances?

@alkanex-xyz
Copy link

We have floodgate on the server behind the proxy. Without we had troubles (some time ago) that bedrockplayers couldn't use pressureplates on p2 plots. Don't know why this happened but with floodgate everything is fine.

Atm we use velocity with modern forwarding without problems.

I don't really get why you have 2 poxys... Did you know that that you can use velocitys forced hosts with Geyser? You need to enable "host-forwarding" or something like that in the Geyser config and the velocity can decide from the domain you're connecting to which server the player should be send to.

@toinouH
Copy link

toinouH commented Nov 25, 2021

You don't need Geyser nor Floodgate in backend servers. You only need floodgate in backend for the API (afaik, maybe my infos are too old).

@oldium
Copy link
Author

oldium commented Nov 25, 2021

I don't really get why you have 2 poxys... Did you know that that you can use velocitys forced hosts with Geyser? You need to enable "host-forwarding" or something like that in the Geyser config and the velocity can decide from the domain you're connecting to which server the player should be send to.

I am using host forwarding on Geyser, also a PROXY protocol between Geyser to Velocity[1], so that I have the client's source address. This is also a difference from Velocity[2], which accepts Java clients directly without a PROXY protocol.

You don't need Geyser nor Floodgate in backend servers. You only need floodgate in backend for the API (afaik, maybe my infos are too old).

This is what I read too. I need to check what is forwarded between Geyser → Velocity and what between Velocity → PaperMC. The PaperMC server running in Velocity mode behaves differently to Server Address field, so I will check whether this is the actual issue.

I will keep you informed when I map the information forwarding strategies for the plugins which I use (Geyser standalone, Geyser Floodgate as Velocity plugin, Geyser Floodgate as Bukkit plugin, FastLogin as Velocity plugin, FastLogin as Bukkit plugin).

@oldium
Copy link
Author

oldium commented Dec 5, 2021

I did not have time to have a look at this, so please be patient. I plan to do the investigation. 😊

@oldium oldium marked this pull request as draft December 5, 2021 18:58
@Tim203
Copy link
Member

Tim203 commented May 15, 2022

I'm closing this draft PR because from what I know modern forwarding is working correctly.
Feel free to reopen the PR if you're able to show the bug.

@Tim203 Tim203 closed this May 15, 2022
h5mcbox added a commit to Linking-ET/Floodgate that referenced this pull request Jun 14, 2025
h5mcbox added a commit to Linking-ET/Floodgate that referenced this pull request Jun 14, 2025
h5mcbox added a commit to Linking-ET/Floodgate that referenced this pull request Jun 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants