-
-
Notifications
You must be signed in to change notification settings - Fork 777
Feature: per-server info forwarding mode #1655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MarcoLvr
wants to merge
10
commits into
PaperMC:dev/3.0.0
Choose a base branch
from
MarcoLvr:feature/per-server-info-forwarding-mode
base: dev/3.0.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+240
−36
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2188381
per-server info forwarding mode.
MarcoLvr e2deb78
ProxyConfig.java: restored getServers() method and created getBackend…
MarcoLvr 7f74964
moved secret key check from VelocityRegisteredServer to VelocityConfi…
MarcoLvr 37f27aa
Removed setters for address and ServerInfoForwardingMode in BackendSe…
MarcoLvr f18b92c
Refactor on BackendServerConfig: now it's a record. Removed its imple…
MarcoLvr 7c0abf9
Improved BackendServerConfig documentation
4drian3d 7b64eae
updated copyright years range. Changed exception handling in ProxyOpt…
MarcoLvr 3cdb05b
Merge branch 'dev/3.0.0' into feature/per-server-info-forwarding-mode
MarcoLvr 915bf50
removed FOLLOWUP mode. Just use a null value and the server will take…
MarcoLvr 015e3c7
improved docs. Forwarding mode is not final in ServerInfo
MarcoLvr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
api/src/main/java/com/velocitypowered/api/proxy/config/BackendServerConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /* | ||
| * Copyright (C) 2018-2025 Velocity Contributors | ||
| * | ||
| * The Velocity API is licensed under the terms of the MIT License. For more details, | ||
| * reference the LICENSE file in the api top-level directory. | ||
| */ | ||
|
|
||
| package com.velocitypowered.api.proxy.config; | ||
|
|
||
| import static java.util.Objects.requireNonNull; | ||
|
|
||
| import com.velocitypowered.api.proxy.server.ServerInfoForwardingMode; | ||
| import org.jspecify.annotations.NullMarked; | ||
| import org.jspecify.annotations.Nullable; | ||
|
|
||
| /** | ||
| * Exposes server configuration information that plugins may use.<br> | ||
| * | ||
| * <b>What's the forwarding mode?</b><br> | ||
| * The server can use a different mode to obtain and forward player info.<br> | ||
| * For instance, if you are running a 1.12 (or lower version) server on a velocity proxy with MODERN player info forwarding | ||
| * the server doesn't support MODERN forwarding. So you need to set LEGACY forwarding mode for that server | ||
| * and velocity will use ONLY FOR THAT SERVER the legacy forwarding mode.<br><br> | ||
| * If the forwarding mode is null it means that the server is using the "player-info-forwarding-mode", set in the config. | ||
| * | ||
| * @param address The address of the backend server. | ||
| * @param forwardingMode The forwarding mode of the backend server. | ||
| * @since 3.4.0 | ||
| * @see ServerInfoForwardingMode | ||
| * @see com.velocitypowered.api.proxy.server.ServerInfo#ServerInfo(String, java.net.InetSocketAddress, ServerInfoForwardingMode) | ||
| * @apiNote <i><b>TIP:</b> If you need to set this value when creating dynamic servers in your plugins | ||
| * you can do that by adding the {@link ServerInfoForwardingMode} value as the last parameter | ||
| * while creating a new {@link com.velocitypowered.api.proxy.server.ServerInfo}.</i> | ||
| */ | ||
| @NullMarked | ||
| public record BackendServerConfig( | ||
| String address, | ||
| @Nullable ServerInfoForwardingMode forwardingMode | ||
| ) { | ||
| public BackendServerConfig { | ||
| requireNonNull(address); | ||
| } | ||
|
|
||
| public BackendServerConfig(final String address) { | ||
| this(address, null); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
api/src/main/java/com/velocitypowered/api/proxy/server/ServerInfoForwardingMode.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| /* | ||
| * Copyright (C) 2018-2025 Velocity Contributors | ||
| * | ||
| * The Velocity API is licensed under the terms of the MIT License. For more details, | ||
| * reference the LICENSE file in the api top-level directory. | ||
| */ | ||
|
|
||
| package com.velocitypowered.api.proxy.server; | ||
|
|
||
| /** | ||
| * Supported per-server player info forwarding methods. | ||
| * | ||
| * @since 3.4.0 | ||
| */ | ||
| public enum ServerInfoForwardingMode { | ||
4drian3d marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| MODERN, | ||
| BUNGEEGUARD, | ||
| LEGACY, | ||
| NONE | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.