diff --git a/api/src/main/java/com/velocitypowered/api/proxy/config/PlayerInfoForwarding.java b/api/src/main/java/com/velocitypowered/api/proxy/config/PlayerInfoForwarding.java new file mode 100644 index 0000000000..acf0e3bd8a --- /dev/null +++ b/api/src/main/java/com/velocitypowered/api/proxy/config/PlayerInfoForwarding.java @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2018-2021 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; + +/** + * Represents what kind of forwarding is configured. + */ +public enum PlayerInfoForwarding { + /** + * Forward player IPs and UUIDs in a format supported by the BungeeGuard + * plugin. Use this if you run servers using Minecraft 1.12 or lower, and are" + * unable to implement network level firewalling (on a shared host). + */ + BUNGEEGUARD, + + /** + * Forwarding mode will be picked from Velocity's configuration. + */ + DEFAULT, + + /** + * No forwarding will be done. All players will appear to be connecting from the + * proxy and will have offline-mode UUIDs. + */ + NONE, + + /** + * Forward player IPs and UUIDs in a BungeeCord-compatible format. Use this if + * you run servers using Minecraft 1.12 or lower. + */ + LEGACY, + + /** + * Forward player IPs and UUIDs as part of the login process using Velocity's + * native forwarding. Only applicable for Minecraft 1.13 or higher. + */ + MODERN, + ; +} diff --git a/api/src/main/java/com/velocitypowered/api/proxy/config/ProxyConfig.java b/api/src/main/java/com/velocitypowered/api/proxy/config/ProxyConfig.java index 831e55af20..694fe81f31 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/config/ProxyConfig.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/config/ProxyConfig.java @@ -86,6 +86,16 @@ public interface ProxyConfig { */ Map getServers(); + /** + * Get a Map of all servers registered in velocity.toml with all details. + * This method does not return all the servers currently in memory, + * although in most cases it does. For a view of all registered servers, + * see {@link ProxyServer#getAllServers()}. + * + * @return registered servers map + */ + Map getServersDetailed(); + /** * Get the order of servers that players will be connected to. * diff --git a/api/src/main/java/com/velocitypowered/api/proxy/config/ServerConnectionInfo.java b/api/src/main/java/com/velocitypowered/api/proxy/config/ServerConnectionInfo.java new file mode 100644 index 0000000000..7e7f770bd6 --- /dev/null +++ b/api/src/main/java/com/velocitypowered/api/proxy/config/ServerConnectionInfo.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2018-2021 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 java.util.Objects; + +/** + * Exposes certain server information. + */ +public final class ServerConnectionInfo { + private final String address; + private final PlayerInfoForwarding forwarding; + + public ServerConnectionInfo(String address, PlayerInfoForwarding forwarding) { + this.address = address; + this.forwarding = forwarding; + } + + public String getAddress() { + return address; + } + + public PlayerInfoForwarding getForwarding() { + return forwarding; + } + + public static ServerConnectionInfo of(String address, PlayerInfoForwarding forwarding) { + return new ServerConnectionInfo(address, forwarding); + } + + @Override + public int hashCode() { + return Objects.hash(address, forwarding); + } + + @Override + public String toString() { + if (forwarding == PlayerInfoForwarding.DEFAULT) { + return "{ address = \"" + address + "\" }"; + } else { + return "{ address = \"" + address + "\", forwarding = \"" + forwarding.name() + "\" }"; + } + } +} diff --git a/api/src/main/java/com/velocitypowered/api/proxy/server/ServerInfo.java b/api/src/main/java/com/velocitypowered/api/proxy/server/ServerInfo.java index fd686297ee..6dc39f86f5 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/server/ServerInfo.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/server/ServerInfo.java @@ -8,6 +8,7 @@ package com.velocitypowered.api.proxy.server; import com.google.common.base.Preconditions; +import com.velocitypowered.api.proxy.config.PlayerInfoForwarding; import java.net.InetSocketAddress; import java.util.Objects; import org.checkerframework.checker.nullness.qual.Nullable; @@ -20,16 +21,21 @@ public final class ServerInfo implements Comparable { private final String name; private final InetSocketAddress address; + private final PlayerInfoForwarding playerInfoForwarding; /** * Creates a new ServerInfo object. * * @param name the name for the server * @param address the address of the server to connect to + * @param playerInfoForwarding the player info forwarding mode this connection will use */ - public ServerInfo(String name, InetSocketAddress address) { + public ServerInfo(String name, InetSocketAddress address, + PlayerInfoForwarding playerInfoForwarding) { this.name = Preconditions.checkNotNull(name, "name"); this.address = Preconditions.checkNotNull(address, "address"); + this.playerInfoForwarding = Preconditions.checkNotNull(playerInfoForwarding, + "playerInfoForwarding"); } public final String getName() { @@ -40,11 +46,16 @@ public final InetSocketAddress getAddress() { return address; } + public final PlayerInfoForwarding getPlayerInfoForwarding() { + return playerInfoForwarding; + } + @Override public String toString() { return "ServerInfo{" + "name='" + name + '\'' + ", address=" + address + + ", playerInfoForwarding=" + playerInfoForwarding + '}'; } @@ -58,12 +69,13 @@ public final boolean equals(@Nullable Object o) { } ServerInfo that = (ServerInfo) o; return Objects.equals(name, that.name) - && Objects.equals(address, that.address); + && Objects.equals(address, that.address) + && Objects.equals(playerInfoForwarding, that.playerInfoForwarding); } @Override public final int hashCode() { - return Objects.hash(name, address); + return Objects.hash(name, address, playerInfoForwarding); } @Override diff --git a/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java b/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java index f113164b8b..5a97851a0f 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java @@ -30,6 +30,7 @@ import com.velocitypowered.api.plugin.PluginManager; import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.ProxyServer; +import com.velocitypowered.api.proxy.config.ServerConnectionInfo; import com.velocitypowered.api.proxy.player.ResourcePackInfo; import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.ServerInfo; @@ -233,8 +234,11 @@ void start() { this.doStartupConfigLoad(); - for (Map.Entry entry : configuration.getServers().entrySet()) { - servers.register(new ServerInfo(entry.getKey(), AddressUtil.parseAddress(entry.getValue()))); + for (Map.Entry entry : configuration + .getServersDetailed().entrySet()) { + ServerConnectionInfo pair = entry.getValue(); + InetSocketAddress serverAddress = AddressUtil.parseAddress(pair.getAddress()); + servers.register(new ServerInfo(entry.getKey(), serverAddress, pair.getForwarding())); } ipAttemptLimiter = Ratelimiters.createWithMilliseconds(configuration.getLoginRatelimit()); @@ -411,9 +415,11 @@ public boolean reloadConfiguration() throws IOException { // Re-register servers. If a server is being replaced, make sure to note what players need to // move back to a fallback server. Collection evacuate = new ArrayList<>(); - for (Map.Entry entry : newConfiguration.getServers().entrySet()) { + for (Map.Entry entry : newConfiguration + .getServersDetailed().entrySet()) { ServerInfo newInfo = - new ServerInfo(entry.getKey(), AddressUtil.parseAddress(entry.getValue())); + new ServerInfo(entry.getKey(), AddressUtil.parseAddress(entry.getValue().getAddress()), + entry.getValue().getForwarding()); Optional rs = servers.getServer(entry.getKey()); if (!rs.isPresent()) { servers.register(newInfo); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/config/PlayerInfoForwarding.java b/proxy/src/main/java/com/velocitypowered/proxy/config/PlayerInfoForwarding.java deleted file mode 100644 index 58ee44a78b..0000000000 --- a/proxy/src/main/java/com/velocitypowered/proxy/config/PlayerInfoForwarding.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2018-2023 Velocity Contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.velocitypowered.proxy.config; - -/** - * Supported player info forwarding methods. - */ -public enum PlayerInfoForwarding { - NONE, - LEGACY, - BUNGEEGUARD, - MODERN -} diff --git a/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java b/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java index 3afd9fc107..fc08cbbbbd 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java @@ -23,8 +23,11 @@ import com.google.common.base.MoreObjects; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Maps; import com.google.gson.annotations.Expose; +import com.velocitypowered.api.proxy.config.PlayerInfoForwarding; import com.velocitypowered.api.proxy.config.ProxyConfig; +import com.velocitypowered.api.proxy.config.ServerConnectionInfo; import com.velocitypowered.api.util.Favicon; import com.velocitypowered.proxy.util.AddressUtil; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -149,6 +152,11 @@ public boolean validate() { } switch (playerInfoForwardingMode) { + case DEFAULT: + logger.error("DEFAULT forwarding mode is not a valid option as a default forwarding mode " + + "setting"); + valid = false; + break; case NONE: logger.warn("Player info forwarding is disabled! All players will appear to be connecting " + "from the proxy and will have offline-mode UUIDs."); @@ -168,9 +176,9 @@ public boolean validate() { logger.warn("You don't have any servers configured."); } - for (Map.Entry entry : servers.getServers().entrySet()) { + for (Map.Entry entry : servers.getServers().entrySet()) { try { - AddressUtil.parseAddress(entry.getValue()); + AddressUtil.parseAddress(entry.getValue().getAddress()); } catch (IllegalArgumentException e) { logger.error("Server {} does not have a valid IP address.", entry.getKey(), e); valid = false; @@ -300,6 +308,11 @@ public byte[] getForwardingSecret() { @Override public Map getServers() { + return Maps.transformValues(servers.getServers(), ServerConnectionInfo::getAddress); + } + + @Override + public Map getServersDetailed() { return servers.getServers(); } @@ -610,10 +623,10 @@ public boolean isOnlineModeKickExistingPlayers() { private static class Servers { - private Map servers = ImmutableMap.of( - "lobby", "127.0.0.1:30066", - "factions", "127.0.0.1:30067", - "minigames", "127.0.0.1:30068" + private Map servers = ImmutableMap.of( + "lobby", ServerConnectionInfo.of("127.0.0.1:30066", PlayerInfoForwarding.DEFAULT), + "factions", ServerConnectionInfo.of("127.0.0.1:30067", PlayerInfoForwarding.DEFAULT), + "minigames", ServerConnectionInfo.of("127.0.0.1:30068", PlayerInfoForwarding.DEFAULT) ); private List attemptConnectionOrder = ImmutableList.of("lobby"); @@ -622,10 +635,22 @@ private Servers() { private Servers(CommentedConfig config) { if (config != null) { - Map servers = new HashMap<>(); + Map servers = new HashMap<>(); for (UnmodifiableConfig.Entry entry : config.entrySet()) { if (entry.getValue() instanceof String) { - servers.put(cleanServerName(entry.getKey()), entry.getValue()); + ServerConnectionInfo info = ServerConnectionInfo.of( + (String) entry.getValue(), PlayerInfoForwarding.DEFAULT + ); + servers.put(cleanServerName(entry.getKey()), info); + } else if (entry.getValue() instanceof CommentedConfig) { + CommentedConfig serverTable = entry.getValue(); + ServerConnectionInfo info = ServerConnectionInfo.of( + serverTable.getOrElse("address", ""), + PlayerInfoForwarding + .valueOf(serverTable.getOrElse("forwarding", "default") + .toUpperCase(Locale.ROOT)) + ); + servers.put(cleanServerName(entry.getKey()), info); } else { if (!entry.getKey().equalsIgnoreCase("try")) { throw new IllegalArgumentException( @@ -638,16 +663,17 @@ private Servers(CommentedConfig config) { } } - private Servers(Map servers, List attemptConnectionOrder) { + private Servers(Map servers, + List attemptConnectionOrder) { this.servers = servers; this.attemptConnectionOrder = attemptConnectionOrder; } - private Map getServers() { + private Map getServers() { return servers; } - public void setServers(Map servers) { + public void setServers(Map servers) { this.servers = servers; } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/ConnectionType.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/ConnectionType.java index 5675d1f579..11cd5f4ce0 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/ConnectionType.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/ConnectionType.java @@ -17,8 +17,8 @@ package com.velocitypowered.proxy.connection; +import com.velocitypowered.api.proxy.config.PlayerInfoForwarding; import com.velocitypowered.api.util.GameProfile; -import com.velocitypowered.proxy.config.PlayerInfoForwarding; import com.velocitypowered.proxy.connection.backend.BackendConnectionPhase; import com.velocitypowered.proxy.connection.client.ClientConnectionPhase; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/LoginSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/LoginSessionHandler.java index 10079db726..db6b35d66c 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/LoginSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/LoginSessionHandler.java @@ -19,10 +19,10 @@ import com.velocitypowered.api.event.player.ServerLoginPluginMessageEvent; import com.velocitypowered.api.network.ProtocolVersion; +import com.velocitypowered.api.proxy.config.PlayerInfoForwarding; import com.velocitypowered.api.proxy.crypto.IdentifiedKey; import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier; import com.velocitypowered.proxy.VelocityServer; -import com.velocitypowered.proxy.config.PlayerInfoForwarding; import com.velocitypowered.proxy.config.VelocityConfiguration; import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; @@ -85,7 +85,11 @@ public boolean handle(EncryptionRequest packet) { public boolean handle(LoginPluginMessage packet) { MinecraftConnection mc = serverConn.ensureConnected(); VelocityConfiguration configuration = server.getConfiguration(); - if (configuration.getPlayerInfoForwardingMode() == PlayerInfoForwarding.MODERN + PlayerInfoForwarding forwardingMode = serverConn.getServerInfo().getPlayerInfoForwarding(); + if (forwardingMode == PlayerInfoForwarding.DEFAULT) { + forwardingMode = configuration.getPlayerInfoForwardingMode(); + } + if (forwardingMode == PlayerInfoForwarding.MODERN && packet.getChannel().equals(VelocityConstants.VELOCITY_IP_FORWARDING_CHANNEL)) { int requestedForwardingVersion = VelocityConstants.MODERN_FORWARDING_DEFAULT; @@ -139,8 +143,12 @@ public boolean handle(SetCompression packet) { @Override public boolean handle(ServerLoginSuccess packet) { - if (server.getConfiguration().getPlayerInfoForwardingMode() == PlayerInfoForwarding.MODERN - && !informationForwarded) { + PlayerInfoForwarding forwardingMode = serverConn.getServerInfo().getPlayerInfoForwarding(); + if (forwardingMode == PlayerInfoForwarding.DEFAULT) { + forwardingMode = server.getConfiguration().getPlayerInfoForwardingMode(); + } + + if (forwardingMode == PlayerInfoForwarding.MODERN && !informationForwarded) { resultFuture.complete(ConnectionRequestResults.forDisconnect(MODERN_IP_FORWARDING_FAILURE, serverConn.getServer())); serverConn.disconnect(); @@ -182,7 +190,11 @@ public void exception(Throwable throwable) { @Override public void disconnected() { - if (server.getConfiguration().getPlayerInfoForwardingMode() == PlayerInfoForwarding.LEGACY) { + PlayerInfoForwarding forwardingMode = serverConn.getServerInfo().getPlayerInfoForwarding(); + if (forwardingMode == PlayerInfoForwarding.DEFAULT) { + forwardingMode = server.getConfiguration().getPlayerInfoForwardingMode(); + } + if (forwardingMode == PlayerInfoForwarding.LEGACY) { resultFuture.completeExceptionally(new QuietRuntimeException( "The connection to the remote server was unexpectedly closed.\n" + "This is usually because the remote server " diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java index 9a4b7d72dc..0e3cba54f4 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java @@ -25,12 +25,12 @@ import com.google.common.collect.ImmutableList; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.proxy.ServerConnection; +import com.velocitypowered.api.proxy.config.PlayerInfoForwarding; import com.velocitypowered.api.proxy.messages.ChannelIdentifier; import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.ServerInfo; import com.velocitypowered.api.util.GameProfile.Property; import com.velocitypowered.proxy.VelocityServer; -import com.velocitypowered.proxy.config.PlayerInfoForwarding; import com.velocitypowered.proxy.connection.ConnectionTypes; import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftConnectionAssociation; @@ -170,7 +170,11 @@ private String createBungeeGuardForwardingAddress(byte[] forwardingSecret) { private void startHandshake() { final MinecraftConnection mc = ensureConnected(); - PlayerInfoForwarding forwardingMode = server.getConfiguration().getPlayerInfoForwardingMode(); + PlayerInfoForwarding forwardingMode = registeredServer + .getServerInfo().getPlayerInfoForwarding(); + if (forwardingMode == PlayerInfoForwarding.DEFAULT) { + forwardingMode = server.getConfiguration().getPlayerInfoForwardingMode(); + } // Initiate the handshake. ProtocolVersion protocolVersion = proxyPlayer.getConnection().getProtocolVersion(); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/AuthSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/AuthSessionHandler.java index 603cf686a6..96230d605c 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/AuthSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/AuthSessionHandler.java @@ -28,12 +28,12 @@ import com.velocitypowered.api.event.player.PlayerChooseInitialServerEvent; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.permission.PermissionFunction; +import com.velocitypowered.api.proxy.config.PlayerInfoForwarding; import com.velocitypowered.api.proxy.crypto.IdentifiedKey; import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.util.GameProfile; import com.velocitypowered.api.util.UuidUtils; import com.velocitypowered.proxy.VelocityServer; -import com.velocitypowered.proxy.config.PlayerInfoForwarding; import com.velocitypowered.proxy.config.VelocityConfiguration; import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/HandshakeSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/HandshakeSessionHandler.java index 079ce035f8..224c5f4202 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/HandshakeSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/HandshakeSessionHandler.java @@ -22,7 +22,6 @@ import com.velocitypowered.api.event.connection.ConnectionHandshakeEvent; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.VelocityServer; -import com.velocitypowered.proxy.config.PlayerInfoForwarding; import com.velocitypowered.proxy.connection.ConnectionType; import com.velocitypowered.proxy.connection.ConnectionTypes; import com.velocitypowered.proxy.connection.MinecraftConnection; @@ -136,15 +135,6 @@ private void handleLogin(Handshake handshake, InitialInboundConnection ic) { connection.setType(getHandshakeConnectionType(handshake)); - // If the proxy is configured for modern forwarding, we must deny connections from 1.12.2 - // and lower, otherwise IP information will never get forwarded. - if (server.getConfiguration().getPlayerInfoForwardingMode() == PlayerInfoForwarding.MODERN - && handshake.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_13) < 0) { - ic.disconnectQuietly( - Component.translatable("velocity.error.modern-forwarding-needs-new-client")); - return; - } - LoginInboundConnection lic = new LoginInboundConnection(ic); server.getEventManager().fireAndForget(new ConnectionHandshakeEvent(lic)); connection.setActiveSessionHandler(StateRegistry.LOGIN, diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/forge/legacy/LegacyForgeConnectionType.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/forge/legacy/LegacyForgeConnectionType.java index 45d19844e5..4c89966b23 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/forge/legacy/LegacyForgeConnectionType.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/forge/legacy/LegacyForgeConnectionType.java @@ -17,8 +17,8 @@ package com.velocitypowered.proxy.connection.forge.legacy; +import com.velocitypowered.api.proxy.config.PlayerInfoForwarding; import com.velocitypowered.api.util.GameProfile; -import com.velocitypowered.proxy.config.PlayerInfoForwarding; import com.velocitypowered.proxy.connection.ConnectionTypes; import com.velocitypowered.proxy.connection.util.ConnectionTypeImpl; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/util/ConnectionTypeImpl.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/util/ConnectionTypeImpl.java index 9e421c5371..31ffd51f37 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/util/ConnectionTypeImpl.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/util/ConnectionTypeImpl.java @@ -17,8 +17,8 @@ package com.velocitypowered.proxy.connection.util; +import com.velocitypowered.api.proxy.config.PlayerInfoForwarding; import com.velocitypowered.api.util.GameProfile; -import com.velocitypowered.proxy.config.PlayerInfoForwarding; import com.velocitypowered.proxy.connection.ConnectionType; import com.velocitypowered.proxy.connection.backend.BackendConnectionPhase; import com.velocitypowered.proxy.connection.client.ClientConnectionPhase; diff --git a/proxy/src/test/java/com/velocitypowered/proxy/util/ServerMapTest.java b/proxy/src/test/java/com/velocitypowered/proxy/util/ServerMapTest.java index c5c6ac3d1b..e98d74e84a 100644 --- a/proxy/src/test/java/com/velocitypowered/proxy/util/ServerMapTest.java +++ b/proxy/src/test/java/com/velocitypowered/proxy/util/ServerMapTest.java @@ -20,6 +20,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; +import com.velocitypowered.api.proxy.config.PlayerInfoForwarding; import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.ServerInfo; import com.velocitypowered.proxy.server.ServerMap; @@ -36,7 +37,7 @@ class ServerMapTest { @Test void respectsCaseInsensitivity() { ServerMap map = new ServerMap(null); - ServerInfo info = new ServerInfo("TestServer", TEST_ADDRESS); + ServerInfo info = new ServerInfo("TestServer", TEST_ADDRESS, PlayerInfoForwarding.NONE); RegisteredServer connection = map.register(info); assertEquals(Optional.of(connection), map.getServer("TestServer")); @@ -47,17 +48,17 @@ void respectsCaseInsensitivity() { @Test void rejectsRepeatedRegisterAttempts() { ServerMap map = new ServerMap(null); - ServerInfo info = new ServerInfo("TestServer", TEST_ADDRESS); + ServerInfo info = new ServerInfo("TestServer", TEST_ADDRESS, PlayerInfoForwarding.NONE); map.register(info); - ServerInfo willReject = new ServerInfo("TESTSERVER", TEST_ADDRESS); + ServerInfo willReject = new ServerInfo("TESTSERVER", TEST_ADDRESS, PlayerInfoForwarding.NONE); assertThrows(IllegalArgumentException.class, () -> map.register(willReject)); } @Test void allowsSameServerLaxRegistrationCheck() { ServerMap map = new ServerMap(null); - ServerInfo info = new ServerInfo("TestServer", TEST_ADDRESS); + ServerInfo info = new ServerInfo("TestServer", TEST_ADDRESS, PlayerInfoForwarding.NONE); RegisteredServer connection = map.register(info); assertEquals(connection, map.register(info)); }