From 78b442a852a14633ea16fa09f3f27b28fd44ea3f Mon Sep 17 00:00:00 2001 From: "Five (Xer)" Date: Thu, 11 Jun 2020 23:39:16 +0200 Subject: [PATCH] Changes 1.16-pre4 and Logic fixes --- .../velocitypowered/api/network/ProtocolVersion.java | 2 +- .../proxy/connection/client/LoginSessionHandler.java | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java b/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java index 4782feb31..6fda2d2b3 100644 --- a/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java +++ b/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java @@ -35,7 +35,7 @@ public enum ProtocolVersion { MINECRAFT_1_15(573, "1.15"), MINECRAFT_1_15_1(575, "1.15.1"), MINECRAFT_1_15_2(578, "1.15.2"), - MINECRAFT_1_16(725, "1.16"); + MINECRAFT_1_16(727, "1.16"); private final int protocol; private final String name; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java index d0707588c..cfe5f4f92 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java @@ -18,7 +18,10 @@ import com.velocitypowered.api.event.permission.PermissionsSetupEvent; import com.velocitypowered.api.event.player.GameProfileRequestEvent; 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; @@ -41,6 +44,7 @@ import java.security.GeneralSecurityException; import java.security.KeyPair; import java.util.Arrays; import java.util.Optional; +import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ThreadLocalRandom; import net.kyori.text.Component; @@ -253,10 +257,14 @@ public class LoginSessionHandler implements MinecraftSessionHandler { mcConnection.write(new SetCompression(threshold)); mcConnection.setCompressionThreshold(threshold); } - + VelocityConfiguration configuration = server.getConfiguration(); + UUID playerUniqueId = player.getUniqueId(); + if (configuration.getPlayerInfoForwardingMode() == PlayerInfoForwarding.NONE) { + playerUniqueId = UuidUtils.generateOfflinePlayerUuid(player.getUsername()); + } ServerLoginSuccess success = new ServerLoginSuccess(); success.setUsername(player.getUsername()); - success.setUuid(player.getUniqueId()); + success.setUuid(playerUniqueId); mcConnection.write(success); mcConnection.setAssociation(player);