3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-16 21:10:30 +01:00

Some minor changes

Dieser Commit ist enthalten in:
Wafarm 2024-07-25 10:31:32 +08:00
Ursprung bf755242e9
Commit c2fb4dbe06
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 63A378FAC9CFCD4D
5 geänderte Dateien mit 19 neuen und 19 gelöschten Zeilen

Datei anzeigen

@ -70,7 +70,7 @@ public class VelocityConfiguration implements ProxyConfig {
@Expose @Expose
private boolean preventClientProxyConnections = false; private boolean preventClientProxyConnections = false;
@Expose @Expose
private PlayerInfoForwarding defaultPlayerInfoForwardingMode = PlayerInfoForwarding.NONE; private PlayerInfoForwarding defaultForwardingMode = PlayerInfoForwarding.NONE;
private byte[] forwardingSecret = generateRandomString(12).getBytes(StandardCharsets.UTF_8); private byte[] forwardingSecret = generateRandomString(12).getBytes(StandardCharsets.UTF_8);
@Expose @Expose
private boolean announceForge = false; private boolean announceForge = false;
@ -103,7 +103,7 @@ public class VelocityConfiguration implements ProxyConfig {
private VelocityConfiguration(String bind, String motd, int showMaxPlayers, boolean onlineMode, private VelocityConfiguration(String bind, String motd, int showMaxPlayers, boolean onlineMode,
boolean preventClientProxyConnections, boolean announceForge, boolean preventClientProxyConnections, boolean announceForge,
PlayerInfoForwarding playerInfoForwardingMode, byte[] forwardingSecret, PlayerInfoForwarding defaultForwardingMode, byte[] forwardingSecret,
boolean onlineModeKickExistingPlayers, PingPassthroughMode pingPassthrough, boolean onlineModeKickExistingPlayers, PingPassthroughMode pingPassthrough,
boolean enablePlayerAddressLogging, Servers servers, ForcedHosts forcedHosts, boolean enablePlayerAddressLogging, Servers servers, ForcedHosts forcedHosts,
Advanced advanced, Query query, Metrics metrics, boolean forceKeyAuthentication) { Advanced advanced, Query query, Metrics metrics, boolean forceKeyAuthentication) {
@ -113,7 +113,7 @@ public class VelocityConfiguration implements ProxyConfig {
this.onlineMode = onlineMode; this.onlineMode = onlineMode;
this.preventClientProxyConnections = preventClientProxyConnections; this.preventClientProxyConnections = preventClientProxyConnections;
this.announceForge = announceForge; this.announceForge = announceForge;
this.defaultPlayerInfoForwardingMode = playerInfoForwardingMode; this.defaultForwardingMode = defaultForwardingMode;
this.forwardingSecret = forwardingSecret; this.forwardingSecret = forwardingSecret;
this.onlineModeKickExistingPlayers = onlineModeKickExistingPlayers; this.onlineModeKickExistingPlayers = onlineModeKickExistingPlayers;
this.pingPassthrough = pingPassthrough; this.pingPassthrough = pingPassthrough;
@ -155,8 +155,8 @@ public class VelocityConfiguration implements ProxyConfig {
for (Map.Entry<String, PlayerInfoForwarding> entry : servers.getServerForwardingModes().entrySet()) { for (Map.Entry<String, PlayerInfoForwarding> entry : servers.getServerForwardingModes().entrySet()) {
switch (entry.getValue()) { switch (entry.getValue()) {
case NONE: case NONE:
logger.warn("Player info forwarding is disabled for " + entry.getKey() + "!" logger.warn("Player info forwarding is disabled for {}!"
+ " All players will appear to be connecting from the proxy and will have offline-mode UUIDs."); + " All players will appear to be connecting from the proxy and will have offline-mode UUIDs.", entry.getKey());
break; break;
case MODERN: case MODERN:
case BUNGEEGUARD: case BUNGEEGUARD:
@ -167,7 +167,7 @@ public class VelocityConfiguration implements ProxyConfig {
} }
} }
switch (defaultPlayerInfoForwardingMode) { switch (defaultForwardingMode) {
case NONE: case NONE:
logger.warn("Player info forwarding is disabled by default! All players will appear to be connecting " logger.warn("Player info forwarding is disabled by default! All players will appear to be connecting "
+ "from the proxy and will have offline-mode UUIDs."); + "from the proxy and will have offline-mode UUIDs.");
@ -182,7 +182,7 @@ public class VelocityConfiguration implements ProxyConfig {
if (requireForwardingSecret && (forwardingSecret == null || forwardingSecret.length == 0)) { if (requireForwardingSecret && (forwardingSecret == null || forwardingSecret.length == 0)) {
logger.error("You don't have a forwarding secret set. This is required for security. " logger.error("You don't have a forwarding secret set. This is required for security. "
+ "See https://docs.papermc.io/velocity/player-information-forwarding for more details."); + "See https://docs.papermc.io/velocity/player-information-forwarding#configuring-modern-forwarding for more details.");
valid = false; valid = false;
} }
@ -312,12 +312,12 @@ public class VelocityConfiguration implements ProxyConfig {
return preventClientProxyConnections; return preventClientProxyConnections;
} }
public PlayerInfoForwarding getDefaultPlayerInfoForwardingMode() { public PlayerInfoForwarding getDefaultForwardingMode() {
return defaultPlayerInfoForwardingMode; return defaultForwardingMode;
} }
public PlayerInfoForwarding getServerPlayerInfoForwardingMode(String server) { public PlayerInfoForwarding getServerForwardingMode(String server) {
return servers.getServerForwardingModes().getOrDefault(server, defaultPlayerInfoForwardingMode); return servers.getServerForwardingModes().getOrDefault(server, defaultForwardingMode);
} }
public byte[] getForwardingSecret() { public byte[] getForwardingSecret() {
@ -437,7 +437,7 @@ public class VelocityConfiguration implements ProxyConfig {
.add("motd", motd) .add("motd", motd)
.add("showMaxPlayers", showMaxPlayers) .add("showMaxPlayers", showMaxPlayers)
.add("onlineMode", onlineMode) .add("onlineMode", onlineMode)
.add("defaultPlayerInfoForwardingMode", defaultPlayerInfoForwardingMode) .add("defaultForwardingMode", defaultForwardingMode)
.add("forwardingSecret", forwardingSecret) .add("forwardingSecret", forwardingSecret)
.add("announceForge", announceForge) .add("announceForge", announceForge)
.add("servers", servers) .add("servers", servers)

Datei anzeigen

@ -83,7 +83,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
public boolean handle(LoginPluginMessagePacket packet) { public boolean handle(LoginPluginMessagePacket packet) {
MinecraftConnection mc = serverConn.ensureConnected(); MinecraftConnection mc = serverConn.ensureConnected();
VelocityConfiguration configuration = server.getConfiguration(); VelocityConfiguration configuration = server.getConfiguration();
if (configuration.getServerPlayerInfoForwardingMode(serverConn.getServerInfo().getName()) == PlayerInfoForwarding.MODERN if (configuration.getServerForwardingMode(serverConn.getServerInfo().getName()) == PlayerInfoForwarding.MODERN
&& packet.getChannel().equals(PlayerDataForwarding.CHANNEL)) { && packet.getChannel().equals(PlayerDataForwarding.CHANNEL)) {
int requestedForwardingVersion = PlayerDataForwarding.MODERN_DEFAULT; int requestedForwardingVersion = PlayerDataForwarding.MODERN_DEFAULT;
@ -143,7 +143,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
@Override @Override
public boolean handle(ServerLoginSuccessPacket packet) { public boolean handle(ServerLoginSuccessPacket packet) {
if (server.getConfiguration().getServerPlayerInfoForwardingMode(serverConn.getServerInfo().getName()) == PlayerInfoForwarding.MODERN if (server.getConfiguration().getServerForwardingMode(serverConn.getServerInfo().getName()) == PlayerInfoForwarding.MODERN
&& !informationForwarded) { && !informationForwarded) {
resultFuture.complete(ConnectionRequestResults.forDisconnect(MODERN_IP_FORWARDING_FAILURE, serverConn.getServer())); resultFuture.complete(ConnectionRequestResults.forDisconnect(MODERN_IP_FORWARDING_FAILURE, serverConn.getServer()));
serverConn.disconnect(); serverConn.disconnect();
@ -203,7 +203,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
@Override @Override
public void disconnected() { public void disconnected() {
if (server.getConfiguration().getServerPlayerInfoForwardingMode(serverConn.getServerInfo().getName()) == PlayerInfoForwarding.LEGACY) { if (server.getConfiguration().getServerForwardingMode(serverConn.getServerInfo().getName()) == PlayerInfoForwarding.LEGACY) {
resultFuture.completeExceptionally(new QuietRuntimeException( resultFuture.completeExceptionally(new QuietRuntimeException(
""" """
The connection to the remote server was unexpectedly closed. The connection to the remote server was unexpectedly closed.

Datei anzeigen

@ -163,7 +163,7 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
private void startHandshake() { private void startHandshake() {
final MinecraftConnection mc = ensureConnected(); final MinecraftConnection mc = ensureConnected();
PlayerInfoForwarding forwardingMode = server.getConfiguration().getServerPlayerInfoForwardingMode(registeredServer.getServerInfo().getName()); PlayerInfoForwarding forwardingMode = server.getConfiguration().getServerForwardingMode(registeredServer.getServerInfo().getName());
// Initiate the handshake. // Initiate the handshake.
ProtocolVersion protocolVersion = proxyPlayer.getConnection().getProtocolVersion(); ProtocolVersion protocolVersion = proxyPlayer.getConnection().getProtocolVersion();

Datei anzeigen

@ -83,7 +83,7 @@ public class AuthSessionHandler implements MinecraftSessionHandler {
public void activated() { public void activated() {
// Some connection types may need to alter the game profile. // Some connection types may need to alter the game profile.
profile = mcConnection.getType().addGameProfileTokensIfRequired(profile, profile = mcConnection.getType().addGameProfileTokensIfRequired(profile,
server.getConfiguration().getDefaultPlayerInfoForwardingMode()); server.getConfiguration().getDefaultForwardingMode());
GameProfileRequestEvent profileRequestEvent = new GameProfileRequestEvent(inbound, profile, GameProfileRequestEvent profileRequestEvent = new GameProfileRequestEvent(inbound, profile,
onlineMode); onlineMode);
final GameProfile finalProfile = profile; final GameProfile finalProfile = profile;
@ -139,7 +139,7 @@ public class AuthSessionHandler implements MinecraftSessionHandler {
} }
VelocityConfiguration configuration = server.getConfiguration(); VelocityConfiguration configuration = server.getConfiguration();
UUID playerUniqueId = player.getUniqueId(); UUID playerUniqueId = player.getUniqueId();
if (configuration.getDefaultPlayerInfoForwardingMode() == PlayerInfoForwarding.NONE) { if (configuration.getDefaultForwardingMode() == PlayerInfoForwarding.NONE) {
playerUniqueId = UuidUtils.generateOfflinePlayerUuid(player.getUsername()); playerUniqueId = UuidUtils.generateOfflinePlayerUuid(player.getUsername());
} }

Datei anzeigen

@ -146,7 +146,7 @@ public class HandshakeSessionHandler implements MinecraftSessionHandler {
// If the proxy is configured for modern forwarding, we must deny connections from 1.12.2 // 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. // and lower, otherwise IP information will never get forwarded.
if (server.getConfiguration().getDefaultPlayerInfoForwardingMode() == PlayerInfoForwarding.MODERN if (server.getConfiguration().getDefaultForwardingMode() == PlayerInfoForwarding.MODERN
&& handshake.getProtocolVersion().lessThan(ProtocolVersion.MINECRAFT_1_13)) { && handshake.getProtocolVersion().lessThan(ProtocolVersion.MINECRAFT_1_13)) {
// Bump connection into correct protocol state so that we can send the disconnect packet. // Bump connection into correct protocol state so that we can send the disconnect packet.
connection.setState(StateRegistry.LOGIN); connection.setState(StateRegistry.LOGIN);