3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-19 22:40:18 +01:00

Initial work on porting to MinecraftAuth

Dieser Commit ist enthalten in:
AlexProgrammerDE 2024-06-20 22:26:54 +02:00
Ursprung fc529a661c
Commit 8c89615922
17 geänderte Dateien mit 135 neuen und 197 gelöschten Zeilen

Datei anzeigen

@ -25,7 +25,7 @@ dependencies {
shadow(libs.protocol.connection) { isTransitive = false }
shadow(libs.protocol.common) { isTransitive = false }
shadow(libs.protocol.codec) { isTransitive = false }
shadow(libs.mcauthlib) { isTransitive = false }
shadow(libs.minecraftauth) { isTransitive = false }
shadow(libs.raknet) { isTransitive = false }
// Consequences of shading + relocating mcauthlib: shadow/relocate mcpl!

Datei anzeigen

@ -25,11 +25,10 @@ dependencies {
api(libs.bundles.protocol)
api(libs.mcauthlib)
api(libs.minecraftauth)
api(libs.mcprotocollib) {
exclude("io.netty", "netty-all")
exclude("com.github.GeyserMC", "packetlib")
exclude("com.github.GeyserMC", "mcauthlib")
exclude("net.raphimc", "MinecraftAuth")
}
implementation(libs.raknet) {

Datei anzeigen

@ -39,7 +39,7 @@ public final class Constants {
public static final String GEYSER_DOWNLOAD_LOCATION = "https://geysermc.org/download";
public static final String UPDATE_PERMISSION = "geyser.update";
static final String SAVED_REFRESH_TOKEN_FILE = "saved-refresh-tokens.json";
static final String SAVED_AUTH_CHAINS_FILE = "saved-auth-chains.json";
public static final String GEYSER_CUSTOM_NAMESPACE = "geyser_custom";

Datei anzeigen

@ -160,7 +160,7 @@ public class GeyserImpl implements GeyserApi {
private PendingMicrosoftAuthentication pendingMicrosoftAuthentication;
@Getter(AccessLevel.NONE)
private Map<String, String> savedRefreshTokens;
private Map<String, String> savedAuthChains;
@Getter
private static GeyserImpl instance;
@ -527,37 +527,37 @@ public class GeyserImpl implements GeyserApi {
if (config.getRemote().authType() == AuthType.ONLINE) {
// May be written/read to on multiple threads from each GeyserSession as well as writing the config
savedRefreshTokens = new ConcurrentHashMap<>();
savedAuthChains = new ConcurrentHashMap<>();
File tokensFile = bootstrap.getSavedUserLoginsFolder().resolve(Constants.SAVED_REFRESH_TOKEN_FILE).toFile();
if (tokensFile.exists()) {
File authChainsFile = bootstrap.getSavedUserLoginsFolder().resolve(Constants.SAVED_AUTH_CHAINS_FILE).toFile();
if (authChainsFile.exists()) {
TypeReference<Map<String, String>> type = new TypeReference<>() { };
Map<String, String> refreshTokenFile = null;
Map<String, String> authChainFile = null;
try {
refreshTokenFile = JSON_MAPPER.readValue(tokensFile, type);
authChainFile = JSON_MAPPER.readValue(authChainsFile, type);
} catch (IOException e) {
logger.error("Cannot load saved user tokens!", e);
}
if (refreshTokenFile != null) {
if (authChainFile != null) {
List<String> validUsers = config.getSavedUserLogins();
boolean doWrite = false;
for (Map.Entry<String, String> entry : refreshTokenFile.entrySet()) {
for (Map.Entry<String, String> entry : authChainFile.entrySet()) {
String user = entry.getKey();
if (!validUsers.contains(user)) {
// Perform a write to this file to purge the now-unused name
doWrite = true;
continue;
}
savedRefreshTokens.put(user, entry.getValue());
savedAuthChains.put(user, entry.getValue());
}
if (doWrite) {
scheduleRefreshTokensWrite();
scheduleAuthChainsWrite();
}
}
}
} else {
savedRefreshTokens = null;
savedAuthChains = null;
}
newsHandler.handleNews(null, NewsItemAction.ON_SERVER_STARTED);
@ -808,11 +808,11 @@ public class GeyserImpl implements GeyserApi {
}
@Nullable
public String refreshTokenFor(@NonNull String bedrockName) {
return savedRefreshTokens.get(bedrockName);
public String authChainFor(@NonNull String bedrockName) {
return savedAuthChains.get(bedrockName);
}
public void saveRefreshToken(@NonNull String bedrockName, @NonNull String refreshToken) {
public void saveAuthChain(@NonNull String bedrockName, @NonNull String authChain) {
if (!getConfig().getSavedUserLogins().contains(bedrockName)) {
// Do not save this login
return;
@ -820,20 +820,20 @@ public class GeyserImpl implements GeyserApi {
// We can safely overwrite old instances because MsaAuthenticationService#getLoginResponseFromRefreshToken
// refreshes the token for us
if (!Objects.equals(refreshToken, savedRefreshTokens.put(bedrockName, refreshToken))) {
scheduleRefreshTokensWrite();
if (!Objects.equals(authChain, savedAuthChains.put(bedrockName, authChain))) {
scheduleAuthChainsWrite();
}
}
private void scheduleRefreshTokensWrite() {
private void scheduleAuthChainsWrite() {
scheduledThread.execute(() -> {
// Ensure all writes are handled on the same thread
File savedTokens = getBootstrap().getSavedUserLoginsFolder().resolve(Constants.SAVED_REFRESH_TOKEN_FILE).toFile();
File savedAuthChains = getBootstrap().getSavedUserLoginsFolder().resolve(Constants.SAVED_AUTH_CHAINS_FILE).toFile();
TypeReference<Map<String, String>> type = new TypeReference<>() { };
try (FileWriter writer = new FileWriter(savedTokens)) {
try (FileWriter writer = new FileWriter(savedAuthChains)) {
JSON_MAPPER.writerFor(type)
.withDefaultPrettyPrinter()
.writeValue(writer, savedRefreshTokens);
.writeValue(writer, this.savedAuthChains);
} catch (IOException e) {
getLogger().error("Unable to write saved refresh tokens!", e);
}

Datei anzeigen

@ -25,7 +25,7 @@
package org.geysermc.geyser.item.type;
import com.github.steveice10.mc.auth.data.GameProfile;
import org.geysermc.mcprotocollib.auth.GameProfile;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.geyser.level.block.type.Block;
import org.geysermc.geyser.session.GeyserSession;

Datei anzeigen

@ -25,7 +25,7 @@
package org.geysermc.geyser.level.block.type;
import com.github.steveice10.mc.auth.data.GameProfile;
import org.geysermc.mcprotocollib.auth.GameProfile;
import org.cloudburstmc.math.vector.Vector3i;
import org.cloudburstmc.nbt.NbtMap;
import org.cloudburstmc.nbt.NbtMapBuilder;

Datei anzeigen

@ -274,10 +274,10 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
private boolean couldLoginUserByName(String bedrockUsername) {
if (geyser.getConfig().getSavedUserLogins().contains(bedrockUsername)) {
String refreshToken = geyser.refreshTokenFor(bedrockUsername);
if (refreshToken != null) {
String authChain = geyser.authChainFor(bedrockUsername);
if (authChain != null) {
geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.auth.stored_credentials", session.getAuthData().name()));
session.authenticateWithRefreshToken(refreshToken);
session.authenticateWithAuthChain(authChain);
return true;
}
}

Datei anzeigen

@ -25,9 +25,12 @@
package org.geysermc.geyser.session;
import com.github.steveice10.mc.auth.data.GameProfile;
import com.github.steveice10.mc.auth.exception.request.RequestException;
import com.github.steveice10.mc.auth.service.MsaAuthenticationService;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import net.raphimc.minecraftauth.step.java.StepMCProfile;
import net.raphimc.minecraftauth.step.java.StepMCToken;
import net.raphimc.minecraftauth.step.java.session.StepFullJavaSession;
import org.geysermc.mcprotocollib.auth.GameProfile;
import io.netty.channel.Channel;
import io.netty.channel.EventLoop;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
@ -554,6 +557,8 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
@Setter @Getter
private Map<String, byte[]> cookies = new Object2ObjectOpenHashMap<>();
private final Gson gson = new Gson();
private final GeyserCameraData cameraData;
private final GeyserEntityData entityData;
@ -691,7 +696,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
}
}
public void authenticateWithRefreshToken(String refreshToken) {
public void authenticateWithAuthChain(String authChain) {
if (loggedIn) {
geyser.getLogger().severe(GeyserLocale.getLocaleStringLog("geyser.auth.already_loggedin", getAuthData().name()));
return;
@ -700,24 +705,23 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
loggingIn = true;
CompletableFuture.supplyAsync(() -> {
MsaAuthenticationService service = new MsaAuthenticationService(GeyserImpl.OAUTH_CLIENT_ID);
service.setRefreshToken(refreshToken);
StepFullJavaSession step = PendingMicrosoftAuthentication.AUTH_FLOW.apply(true, 30);
StepFullJavaSession.FullJavaSession response;
try {
service.login();
} catch (RequestException e) {
response = step.refresh(PendingMicrosoftAuthentication.AUTH_CLIENT, step.fromJson(gson.fromJson(authChain, JsonObject.class)));
} catch (Exception e) {
geyser.getLogger().error("Error while attempting to use refresh token for " + bedrockUsername() + "!", e);
return Boolean.FALSE;
}
GameProfile profile = service.getSelectedProfile();
if (profile == null) {
// Java account is offline
disconnect(GeyserLocale.getPlayerLocaleString("geyser.network.remote.invalid_account", clientData.getLanguageCode()));
return null;
}
StepMCProfile.MCProfile mcProfile = response.getMcProfile();
StepMCToken.MCToken mcToken = mcProfile.getMcToken();
protocol = new MinecraftProtocol(profile, service.getAccessToken());
geyser.saveRefreshToken(bedrockUsername(), service.getRefreshToken());
protocol = new MinecraftProtocol(
new GameProfile(mcProfile.getId(), mcProfile.getName()),
mcToken.getAccessToken()
);
geyser.saveAuthChain(bedrockUsername(), gson.toJson(step.toJson(response)));
return Boolean.TRUE;
}).whenComplete((successful, ex) -> {
if (this.closed) {
@ -762,25 +766,15 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
final PendingMicrosoftAuthentication.AuthenticationTask task = geyser.getPendingMicrosoftAuthentication().getOrCreateTask(
getAuthData().xuid()
);
task.setOnline(true);
task.resetTimer();
if (task.getAuthentication().isDone()) {
onMicrosoftLoginComplete(task);
} else {
task.getCode(offlineAccess).whenComplete((response, ex) -> {
boolean connected = !closed;
if (ex != null) {
if (connected) {
geyser.getLogger().error("Failed to get Microsoft auth code", ex);
disconnect(ex.toString());
}
task.cleanup(); // error getting auth code -> clean up immediately
} else if (connected) {
LoginEncryptionUtils.buildAndShowMicrosoftCodeWindow(this, response);
task.getAuthentication().whenComplete((r, $) -> onMicrosoftLoginComplete(task));
task.resetRunningFlow();
task.performLoginAttempt(offlineAccess, code -> {
if (!closed) {
LoginEncryptionUtils.buildAndShowMicrosoftCodeWindow(this, code);
}
});
}).handle((r, e) -> onMicrosoftLoginComplete(task));
}
}
@ -792,36 +786,31 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
return false;
}
task.cleanup(); // player is online -> remove pending authentication immediately
Throwable ex = task.getLoginException();
if (ex != null) {
geyser.getLogger().error("Failed to log in with Microsoft code!", ex);
disconnect(ex.toString());
} else {
MsaAuthenticationService service = task.getMsaAuthenticationService();
GameProfile selectedProfile = service.getSelectedProfile();
if (selectedProfile == null) {
disconnect(GeyserLocale.getPlayerLocaleString(
"geyser.network.remote.invalid_account",
clientData.getLanguageCode()
));
} else {
this.protocol = new MinecraftProtocol(
selectedProfile,
service.getAccessToken()
);
try {
connectDownstream();
} catch (Throwable t) {
t.printStackTrace();
return false;
}
return task.getAuthentication().handle((response, ex) -> {
if (ex != null) {
geyser.getLogger().error("Failed to log in with Microsoft code!", ex);
disconnect(ex.toString());
return false;
}
// Save our refresh token for later use
geyser.saveRefreshToken(bedrockUsername(), service.getRefreshToken());
return true;
}
}
return false;
StepMCProfile.MCProfile mcProfile = response.getMcProfile();
StepMCToken.MCToken mcToken = mcProfile.getMcToken();
this.protocol = new MinecraftProtocol(
new GameProfile(mcProfile.getId(), mcProfile.getName()),
mcToken.getAccessToken()
);
try {
connectDownstream();
} catch (Throwable t) {
t.printStackTrace();
return false;
}
// Save our refresh token for later use
geyser.saveAuthChain(bedrockUsername(), mcToken.getXblXsts().getInitialXblSession().getMsaToken().getRefreshToken());
return true;
}).join();
}
/**
@ -1099,7 +1088,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
if (authData != null) {
PendingMicrosoftAuthentication.AuthenticationTask task = geyser.getPendingMicrosoftAuthentication().getTask(authData.xuid());
if (task != null) {
task.setOnline(false);
task.resetRunningFlow();
}
}
}

Datei anzeigen

@ -25,27 +25,41 @@
package org.geysermc.geyser.session;
import com.github.steveice10.mc.auth.exception.request.AuthPendingException;
import com.github.steveice10.mc.auth.exception.request.RequestException;
import com.github.steveice10.mc.auth.service.MsaAuthenticationService;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import lombok.Getter;
import lombok.Setter;
import lombok.SneakyThrows;
import net.lenni0451.commons.httpclient.HttpClient;
import net.raphimc.minecraftauth.MinecraftAuth;
import net.raphimc.minecraftauth.step.java.session.StepFullJavaSession;
import net.raphimc.minecraftauth.step.msa.StepMsaDeviceCode;
import net.raphimc.minecraftauth.util.MicrosoftConstants;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.GeyserLogger;
import java.io.Serial;
import java.util.concurrent.*;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.Function;
/**
* Pending Microsoft authentication task cache.
* It permits user to exit the server while they authorize Geyser to access their Microsoft account.
*/
public class PendingMicrosoftAuthentication {
public static final HttpClient AUTH_CLIENT = MinecraftAuth.createHttpClient();
public static final BiFunction<Boolean, Integer, StepFullJavaSession> AUTH_FLOW = (offlineAccess, timeoutSec) -> MinecraftAuth.builder()
.withClientId(GeyserImpl.OAUTH_CLIENT_ID)
.withScope(offlineAccess ? "XboxLive.signin" : "XboxLive.signin XboxLive.offline_access")
.withTimeout(timeoutSec)
.deviceCode()
.withoutDeviceToken()
.regularAuthentication(MicrosoftConstants.JAVA_XSTS_RELYING_PARTY)
.buildMinecraftJavaProfileStep(false);
/**
* For GeyserConnect usage.
*/
@ -57,8 +71,8 @@ public class PendingMicrosoftAuthentication {
.build(new CacheLoader<>() {
@Override
public AuthenticationTask load(@NonNull String userKey) {
return storeServerInformation ? new ProxyAuthenticationTask(userKey, timeoutSeconds * 1000L)
: new AuthenticationTask(userKey, timeoutSeconds * 1000L);
return storeServerInformation ? new ProxyAuthenticationTask(userKey, timeoutSeconds)
: new AuthenticationTask(userKey, timeoutSeconds);
}
});
}
@ -80,37 +94,19 @@ public class PendingMicrosoftAuthentication {
public class AuthenticationTask {
private static final Executor DELAYED_BY_ONE_SECOND = CompletableFuture.delayedExecutor(1, TimeUnit.SECONDS);
@Getter
private final MsaAuthenticationService msaAuthenticationService = new MsaAuthenticationService(GeyserImpl.OAUTH_CLIENT_ID);
private final String userKey;
private final long timeoutMs;
private long remainingTimeMs;
@Setter
private boolean online = true;
private final int timeoutSec;
@Getter
private final CompletableFuture<MsaAuthenticationService> authentication;
private CompletableFuture<StepFullJavaSession.FullJavaSession> authentication;
@Getter
private volatile Throwable loginException;
private AuthenticationTask(String userKey, long timeoutMs) {
private AuthenticationTask(String userKey, int timeoutSec) {
this.userKey = userKey;
this.timeoutMs = timeoutMs;
this.remainingTimeMs = timeoutMs;
this.authentication = new CompletableFuture<>();
this.authentication.whenComplete((r, ex) -> {
this.loginException = ex;
// avoid memory leak, in case player doesn't connect again
CompletableFuture.delayedExecutor(timeoutMs, TimeUnit.MILLISECONDS).execute(this::cleanup);
});
this.timeoutSec = timeoutSec;
}
public void resetTimer() {
this.remainingTimeMs = this.timeoutMs;
public void resetRunningFlow() {
// Interrupt the current flow
this.authentication.cancel(true);
}
public void cleanup() {
@ -121,52 +117,18 @@ public class PendingMicrosoftAuthentication {
authentications.invalidate(userKey);
}
public CompletableFuture<MsaAuthenticationService.MsCodeResponse> getCode(boolean offlineAccess) {
// Request the code
CompletableFuture<MsaAuthenticationService.MsCodeResponse> code = CompletableFuture.supplyAsync(
() -> tryGetCode(offlineAccess));
// Once the code is received, continuously try to request the access token, profile, etc
code.thenRun(() -> performLoginAttempt(System.currentTimeMillis()));
return code;
}
/**
* @param offlineAccess whether we want a refresh token for later use.
*/
private MsaAuthenticationService.MsCodeResponse tryGetCode(boolean offlineAccess) throws CompletionException {
try {
return msaAuthenticationService.getAuthCode(offlineAccess);
} catch (RequestException e) {
throw new CompletionException(e);
}
}
private void performLoginAttempt(long lastAttempt) {
CompletableFuture.runAsync(() -> {
public CompletableFuture<StepFullJavaSession.FullJavaSession> performLoginAttempt(boolean offlineAccess, Consumer<StepMsaDeviceCode.MsaDeviceCode> deviceCodeConsumer) {
return authentication = CompletableFuture.supplyAsync(() -> {
try {
msaAuthenticationService.login();
} catch (AuthPendingException e) {
long currentAttempt = System.currentTimeMillis();
if (!online) {
// decrement timer only when player's offline
remainingTimeMs -= currentAttempt - lastAttempt;
if (remainingTimeMs <= 0L) {
// time's up
authentication.completeExceptionally(new TaskTimeoutException());
cleanup();
return;
}
}
// try again in 1 second
performLoginAttempt(currentAttempt);
return;
return AUTH_FLOW.apply(offlineAccess, timeoutSec)
.getFromInput(AUTH_CLIENT, new StepMsaDeviceCode.MsaDeviceCodeCallback(deviceCodeConsumer));
} catch (Exception e) {
authentication.completeExceptionally(e);
return;
throw new CompletionException(e);
}
// login successful
authentication.complete(msaAuthenticationService);
}, DELAYED_BY_ONE_SECOND);
}, DELAYED_BY_ONE_SECOND).whenComplete((r, ex) -> {
// avoid memory leak, in case player doesn't connect again
CompletableFuture.delayedExecutor(timeoutSec, TimeUnit.SECONDS).execute(this::cleanup);
});
}
@Override
@ -181,8 +143,8 @@ public class PendingMicrosoftAuthentication {
private String server;
private int port;
private ProxyAuthenticationTask(String userKey, long timeoutMs) {
super(userKey, timeoutMs);
private ProxyAuthenticationTask(String userKey, int timeoutSec) {
super(userKey, timeoutSec);
}
}

Datei anzeigen

@ -25,11 +25,10 @@
package org.geysermc.geyser.skin;
import com.github.steveice10.mc.auth.data.GameProfile;
import com.github.steveice10.mc.auth.data.GameProfile.Texture;
import com.github.steveice10.mc.auth.data.GameProfile.TextureModel;
import com.github.steveice10.mc.auth.data.GameProfile.TextureType;
import com.github.steveice10.mc.auth.exception.property.PropertyException;
import org.geysermc.mcprotocollib.auth.GameProfile;
import org.geysermc.mcprotocollib.auth.GameProfile.Texture;
import org.geysermc.mcprotocollib.auth.GameProfile.TextureModel;
import org.geysermc.mcprotocollib.auth.GameProfile.TextureType;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
@ -113,12 +112,7 @@ public class FakeHeadProvider {
return;
}
Map<TextureType, Texture> textures = null;
try {
textures = profile.getTextures(false);
} catch (PropertyException e) {
session.getGeyser().getLogger().debug("Failed to get textures from GameProfile: " + e);
}
Map<TextureType, Texture> textures = profile.getTextures(false);
if (textures == null || textures.isEmpty()) {
loadHead(session, entity, profile.getName());

Datei anzeigen

@ -25,10 +25,9 @@
package org.geysermc.geyser.translator.item;
import com.github.steveice10.mc.auth.data.GameProfile;
import com.github.steveice10.mc.auth.data.GameProfile.Texture;
import com.github.steveice10.mc.auth.data.GameProfile.TextureType;
import com.github.steveice10.mc.auth.exception.property.PropertyException;
import org.geysermc.mcprotocollib.auth.GameProfile;
import org.geysermc.mcprotocollib.auth.GameProfile.Texture;
import org.geysermc.mcprotocollib.auth.GameProfile.TextureType;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import org.checkerframework.checker.nullness.qual.NonNull;
@ -465,12 +464,7 @@ public final class ItemTranslator {
GameProfile profile = components.get(DataComponentType.PROFILE);
if (profile != null) {
Map<TextureType, Texture> textures = null;
try {
textures = profile.getTextures(false);
} catch (PropertyException e) {
GeyserImpl.getInstance().getLogger().debug("Failed to get textures from GameProfile: " + e);
}
Map<TextureType, Texture> textures = profile.getTextures(false);
if (textures == null || textures.isEmpty()) {
return null;

Datei anzeigen

@ -46,7 +46,7 @@ public class BedrockSetLocalPlayerAsInitializedTranslator extends PacketTranslat
if (session.remoteServer().authType() == AuthType.ONLINE) {
if (!session.isLoggedIn()) {
if (session.getGeyser().getConfig().getSavedUserLogins().contains(session.bedrockUsername())) {
if (session.getGeyser().refreshTokenFor(session.bedrockUsername()) == null) {
if (session.getGeyser().authChainFor(session.bedrockUsername()) == null) {
LoginEncryptionUtils.buildAndShowConsentWindow(session);
} else {
// If the refresh token is not null and we're here, then the refresh token expired

Datei anzeigen

@ -25,7 +25,7 @@
package org.geysermc.geyser.translator.protocol.java;
import com.github.steveice10.mc.auth.data.GameProfile;
import org.geysermc.mcprotocollib.auth.GameProfile;
import net.kyori.adventure.key.Key;
import org.geysermc.geyser.api.network.AuthType;
import org.geysermc.geyser.entity.type.player.PlayerEntity;

Datei anzeigen

@ -25,7 +25,7 @@
package org.geysermc.geyser.translator.protocol.java.entity.player;
import com.github.steveice10.mc.auth.data.GameProfile;
import org.geysermc.mcprotocollib.auth.GameProfile;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.cloudburstmc.math.vector.Vector3f;
import org.cloudburstmc.protocol.bedrock.packet.PlayerListPacket;

Datei anzeigen

@ -28,7 +28,7 @@ package org.geysermc.geyser.util;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.steveice10.mc.auth.service.MsaAuthenticationService;
import net.raphimc.minecraftauth.step.msa.StepMsaDeviceCode;
import org.cloudburstmc.protocol.bedrock.packet.LoginPacket;
import org.cloudburstmc.protocol.bedrock.packet.ServerToClientHandshakePacket;
import org.cloudburstmc.protocol.bedrock.util.ChainValidationResult;
@ -203,7 +203,7 @@ public class LoginEncryptionUtils {
/**
* Shows the code that a user must input into their browser
*/
public static void buildAndShowMicrosoftCodeWindow(GeyserSession session, MsaAuthenticationService.MsCodeResponse msCode) {
public static void buildAndShowMicrosoftCodeWindow(GeyserSession session, StepMsaDeviceCode.MsaDeviceCode msCode) {
String locale = session.locale();
StringBuilder message = new StringBuilder("%xbox.signin.website\n")
@ -212,7 +212,7 @@ public class LoginEncryptionUtils {
.append(ChatColor.RESET)
.append("\n%xbox.signin.enterCode\n")
.append(ChatColor.GREEN)
.append(msCode.user_code);
.append(msCode.getUserCode());
int timeout = session.getGeyser().getConfig().getPendingAuthenticationTimeout();
if (timeout != 0) {
message.append("\n\n")

@ -1 +1 @@
Subproject commit 23cb22f9ceeb7f24b896a69a711944d7f3e756ed
Subproject commit ff44a32574d0cac242aa99d8f97af0b5c636c0cf

Datei anzeigen

@ -12,8 +12,8 @@ gson = "2.3.1" # Provided by Spigot 1.8.8
websocket = "1.5.1"
protocol = "3.0.0.Beta2-20240616.144648-10"
raknet = "1.0.0.CR3-20240416.144209-1"
mcauthlib = "e5b0bcc"
mcprotocollib = "1.21-20240616.154144-5"
minecraftauth = "4.0.2"
mcprotocollib = "1.21-20240618.151504-8"
adventure = "4.14.0"
adventure-platform = "4.3.0"
junit = "5.9.2"
@ -107,7 +107,7 @@ commodore = { group = "me.lucko", name = "commodore", version.ref = "commodore"
guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
junit = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit" }
mcauthlib = { group = "com.github.GeyserMC", name = "MCAuthLib", version.ref = "mcauthlib" }
minecraftauth = { group = "net.raphimc", name = "MinecraftAuth", version.ref = "minecraftauth" }
mcprotocollib = { group = "org.geysermc.mcprotocollib", name = "protocol", version.ref = "mcprotocollib" }
raknet = { group = "org.cloudburstmc.netty", name = "netty-transport-raknet", version.ref = "raknet" }
terminalconsoleappender = { group = "net.minecrell", name = "terminalconsoleappender", version.ref = "terminalconsoleappender" }