Restore offline mode support for Fabric servers (#3576)

This commit is contained in:
nikijaz 2023-01-29 13:41:38 +03:00 committed by GitHub
parent 3ecdeacaf8
commit a5ba53d765
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,6 +46,7 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerLoginNetworkHandler;
import net.minecraft.server.network.ServerPlayNetworkHandler;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Uuids;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@ -69,7 +70,7 @@ public class FabricConnectionListener extends AbstractConnectionListener {
// Get their profile from the net handler - it should have been initialised by now.
GameProfile profile = ((ServerLoginNetworkHandlerAccessor) netHandler).getGameProfile();
UUID uniqueId = profile.getId();
UUID uniqueId = profile.isComplete() ? profile.getId() : Uuids.getOfflinePlayerUuid(profile.getName());
String username = profile.getName();
if (this.plugin.getConfiguration().get(ConfigKeys.DEBUG_LOGINS)) {