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:
Ursprung
bf755242e9
Commit
c2fb4dbe06
@ -70,7 +70,7 @@ public class VelocityConfiguration implements ProxyConfig {
|
||||
@Expose
|
||||
private boolean preventClientProxyConnections = false;
|
||||
@Expose
|
||||
private PlayerInfoForwarding defaultPlayerInfoForwardingMode = PlayerInfoForwarding.NONE;
|
||||
private PlayerInfoForwarding defaultForwardingMode = PlayerInfoForwarding.NONE;
|
||||
private byte[] forwardingSecret = generateRandomString(12).getBytes(StandardCharsets.UTF_8);
|
||||
@Expose
|
||||
private boolean announceForge = false;
|
||||
@ -103,7 +103,7 @@ public class VelocityConfiguration implements ProxyConfig {
|
||||
|
||||
private VelocityConfiguration(String bind, String motd, int showMaxPlayers, boolean onlineMode,
|
||||
boolean preventClientProxyConnections, boolean announceForge,
|
||||
PlayerInfoForwarding playerInfoForwardingMode, byte[] forwardingSecret,
|
||||
PlayerInfoForwarding defaultForwardingMode, byte[] forwardingSecret,
|
||||
boolean onlineModeKickExistingPlayers, PingPassthroughMode pingPassthrough,
|
||||
boolean enablePlayerAddressLogging, Servers servers, ForcedHosts forcedHosts,
|
||||
Advanced advanced, Query query, Metrics metrics, boolean forceKeyAuthentication) {
|
||||
@ -113,7 +113,7 @@ public class VelocityConfiguration implements ProxyConfig {
|
||||
this.onlineMode = onlineMode;
|
||||
this.preventClientProxyConnections = preventClientProxyConnections;
|
||||
this.announceForge = announceForge;
|
||||
this.defaultPlayerInfoForwardingMode = playerInfoForwardingMode;
|
||||
this.defaultForwardingMode = defaultForwardingMode;
|
||||
this.forwardingSecret = forwardingSecret;
|
||||
this.onlineModeKickExistingPlayers = onlineModeKickExistingPlayers;
|
||||
this.pingPassthrough = pingPassthrough;
|
||||
@ -155,8 +155,8 @@ public class VelocityConfiguration implements ProxyConfig {
|
||||
for (Map.Entry<String, PlayerInfoForwarding> entry : servers.getServerForwardingModes().entrySet()) {
|
||||
switch (entry.getValue()) {
|
||||
case NONE:
|
||||
logger.warn("Player info forwarding is disabled for " + entry.getKey() + "!"
|
||||
+ " All players will appear to be connecting from the proxy and will have offline-mode UUIDs.");
|
||||
logger.warn("Player info forwarding is disabled for {}!"
|
||||
+ " All players will appear to be connecting from the proxy and will have offline-mode UUIDs.", entry.getKey());
|
||||
break;
|
||||
case MODERN:
|
||||
case BUNGEEGUARD:
|
||||
@ -167,7 +167,7 @@ public class VelocityConfiguration implements ProxyConfig {
|
||||
}
|
||||
}
|
||||
|
||||
switch (defaultPlayerInfoForwardingMode) {
|
||||
switch (defaultForwardingMode) {
|
||||
case NONE:
|
||||
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.");
|
||||
@ -182,7 +182,7 @@ public class VelocityConfiguration implements ProxyConfig {
|
||||
|
||||
if (requireForwardingSecret && (forwardingSecret == null || forwardingSecret.length == 0)) {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -312,12 +312,12 @@ public class VelocityConfiguration implements ProxyConfig {
|
||||
return preventClientProxyConnections;
|
||||
}
|
||||
|
||||
public PlayerInfoForwarding getDefaultPlayerInfoForwardingMode() {
|
||||
return defaultPlayerInfoForwardingMode;
|
||||
public PlayerInfoForwarding getDefaultForwardingMode() {
|
||||
return defaultForwardingMode;
|
||||
}
|
||||
|
||||
public PlayerInfoForwarding getServerPlayerInfoForwardingMode(String server) {
|
||||
return servers.getServerForwardingModes().getOrDefault(server, defaultPlayerInfoForwardingMode);
|
||||
public PlayerInfoForwarding getServerForwardingMode(String server) {
|
||||
return servers.getServerForwardingModes().getOrDefault(server, defaultForwardingMode);
|
||||
}
|
||||
|
||||
public byte[] getForwardingSecret() {
|
||||
@ -437,7 +437,7 @@ public class VelocityConfiguration implements ProxyConfig {
|
||||
.add("motd", motd)
|
||||
.add("showMaxPlayers", showMaxPlayers)
|
||||
.add("onlineMode", onlineMode)
|
||||
.add("defaultPlayerInfoForwardingMode", defaultPlayerInfoForwardingMode)
|
||||
.add("defaultForwardingMode", defaultForwardingMode)
|
||||
.add("forwardingSecret", forwardingSecret)
|
||||
.add("announceForge", announceForge)
|
||||
.add("servers", servers)
|
||||
|
@ -83,7 +83,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
||||
public boolean handle(LoginPluginMessagePacket packet) {
|
||||
MinecraftConnection mc = serverConn.ensureConnected();
|
||||
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)) {
|
||||
|
||||
int requestedForwardingVersion = PlayerDataForwarding.MODERN_DEFAULT;
|
||||
@ -143,7 +143,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
||||
|
||||
@Override
|
||||
public boolean handle(ServerLoginSuccessPacket packet) {
|
||||
if (server.getConfiguration().getServerPlayerInfoForwardingMode(serverConn.getServerInfo().getName()) == PlayerInfoForwarding.MODERN
|
||||
if (server.getConfiguration().getServerForwardingMode(serverConn.getServerInfo().getName()) == PlayerInfoForwarding.MODERN
|
||||
&& !informationForwarded) {
|
||||
resultFuture.complete(ConnectionRequestResults.forDisconnect(MODERN_IP_FORWARDING_FAILURE, serverConn.getServer()));
|
||||
serverConn.disconnect();
|
||||
@ -203,7 +203,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
||||
|
||||
@Override
|
||||
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(
|
||||
"""
|
||||
The connection to the remote server was unexpectedly closed.
|
||||
|
@ -163,7 +163,7 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
|
||||
|
||||
private void startHandshake() {
|
||||
final MinecraftConnection mc = ensureConnected();
|
||||
PlayerInfoForwarding forwardingMode = server.getConfiguration().getServerPlayerInfoForwardingMode(registeredServer.getServerInfo().getName());
|
||||
PlayerInfoForwarding forwardingMode = server.getConfiguration().getServerForwardingMode(registeredServer.getServerInfo().getName());
|
||||
|
||||
// Initiate the handshake.
|
||||
ProtocolVersion protocolVersion = proxyPlayer.getConnection().getProtocolVersion();
|
||||
|
@ -83,7 +83,7 @@ public class AuthSessionHandler implements MinecraftSessionHandler {
|
||||
public void activated() {
|
||||
// Some connection types may need to alter the game profile.
|
||||
profile = mcConnection.getType().addGameProfileTokensIfRequired(profile,
|
||||
server.getConfiguration().getDefaultPlayerInfoForwardingMode());
|
||||
server.getConfiguration().getDefaultForwardingMode());
|
||||
GameProfileRequestEvent profileRequestEvent = new GameProfileRequestEvent(inbound, profile,
|
||||
onlineMode);
|
||||
final GameProfile finalProfile = profile;
|
||||
@ -139,7 +139,7 @@ public class AuthSessionHandler implements MinecraftSessionHandler {
|
||||
}
|
||||
VelocityConfiguration configuration = server.getConfiguration();
|
||||
UUID playerUniqueId = player.getUniqueId();
|
||||
if (configuration.getDefaultPlayerInfoForwardingMode() == PlayerInfoForwarding.NONE) {
|
||||
if (configuration.getDefaultForwardingMode() == PlayerInfoForwarding.NONE) {
|
||||
playerUniqueId = UuidUtils.generateOfflinePlayerUuid(player.getUsername());
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
// 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)) {
|
||||
// Bump connection into correct protocol state so that we can send the disconnect packet.
|
||||
connection.setState(StateRegistry.LOGIN);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren