Skip to content

Adding more options for configuring ping passthrough. - #1870

Open
TheMiningTeamYT wants to merge 11 commits into
PaperMC:dev/4.0.0from
TheMiningTeamYT:ping-passthrough-clean
Open

Adding more options for configuring ping passthrough.#1870
TheMiningTeamYT wants to merge 11 commits into
PaperMC:dev/4.0.0from
TheMiningTeamYT:ping-passthrough-clean

Conversation

@TheMiningTeamYT

Copy link
Copy Markdown

This pull request replaces pull request #1519. The existing code has had its commit history cleaned up, brought up to compatibility with the current head of the new active branch dev/4.0.0, and had its configuration options moved into their own section as was previously requested.
What follows is the description from the original pull request.
When using Velocity, I have been frustrated by the lack of fine control over ping passthrough, specifically the lack of support for passing through favicons without passing through the whole ping request. I've also seen people on line asking how to pass through favicons, so I decided to add the ability to control which aspects of server list ping requests are passed through from the back end server, and which aspects aren't, through 5 new boolean configuration options in the config file.

MODS,
DESCRIPTION,
ALL
public class PingPassthroughMode {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

make this a record, and put the default value as a static default inside of here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

What do you mean "put the default value as a static default"? I'm not too familiar with Java in general or records in particular (I had to google them to even know what you were talking about).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

public static final PingPassthroughMode DEFAULT = new Ping....

That way the default is contained alongside the definitions of all of those booleans

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I think I understand; you want an instance of ping passthrough mode in the file just to indicate what the defaults are, yes? Or are you wanting me to use it in some specific way?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Actually it might be a good idea to do something like the new packet limiter code

Comment thread proxy/src/main/resources/default-velocity.toml Outdated
" Should Velocity pass the favicon (also known as the server icon) from the backend server when responding to server list ping requests?"
);

// Create ping passthrough entry for the mods info

@WouterGritter WouterGritter Aug 26, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think these // Create ping passthrough entry for the X comments are adding much value, they can be omitted

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'll be honest, I agree with you. They have now been removed.

Comment thread proxy/src/main/java/com/velocitypowered/proxy/config/PingPassthroughMode.java Outdated
|| this.modinfo;
}

// Not used, just here to state what the defaults are.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not used, just here to state what the defaults are.

This is odd, why not use this in VelocityConfiguration line 83?

@WouterGritter WouterGritter Aug 26, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Or I'd actually just overload the record constructor with the defaults (all false) and use it in VelocityConfiguration.

This doesn't work well with using DEFAULT in the getOrElses, but you can ofc do both - public static final PingPassthroughMode DEFAULT = new PingPassthroughMode();, either is fine

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'm getting conflicting requests here. I'd appreciate it if y'all could decide on what you want me to implement (or just deal with it among yourselves after accepting the pull request).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not really conflicting, the comment was that the default instance should exist here rather than being an anonymous default instance created elsewhere, this can then be used for the defaults elsewhere

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ah okay.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Alright, done. I ended up implementing both the overloaded constructor and the default PingPassthroughMode as @WouterGritter suggested. However, I kept the initialization of pingPassthrough in VelocityConfiguration.java line 83 as private PingPassthroughMode pingPassthrough = PingPassthroughMode.DEFAULT; since that's more in line with how the rest of the code is written.

Comment thread proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java Outdated
private boolean onlineModeKickExistingPlayers = false;
@Expose
private PingPassthroughMode pingPassthrough = PingPassthroughMode.DISABLED;
private PingPassthroughMode pingPassthrough = new PingPassthroughMode(false, false, false, false, false);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

= PingPassthroughMode.DEFAULT

was the primary change I suggested rather than having this randomly created instance;

the blow block of getOrElse() can also use the default instance, that way it's all defined in a singular place

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ah okay I understand now. I honestly forgot that was there. That being said, I think change this to function more like the PacketLimiterConfig. I like how it puts all the code for parsing the sections in one place. Unless you disagree.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The limiter config was just a quick toss together for the sake of getting this out, if I wanted everything in one place I would just have PingPassthroughMode.of(CommentedConfig) for that

@TheMiningTeamYT TheMiningTeamYT Aug 26, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The limiter config was just a quick toss together for the sake of getting this out

Let me ask then, is there a different way you would prefer me to do this?
(Sorry if I come of as a bit annoying, I'm not the most experienced Java developer and I really wanna make sure I do this right so this PR can finally be merged).

@TheMiningTeamYT

Copy link
Copy Markdown
Author

By the way, out of the scope this pull request, but while working on it I discovered that your gitignore doesn't include VS Code's workspace config directory (.vscode). Just thought y'all should know. I may open a pull request for this at some point.

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