mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-19 08:46:09 -04:00
Fix chat is broken on Minecraft 1.20
This commit is contained in:
parent
0280a34d00
commit
4b2e857f08
@ -30,6 +30,7 @@ import java.util.UUID;
|
||||
*/
|
||||
@Immutable
|
||||
public class AuthInfo implements AutoCloseable {
|
||||
public static final String USER_TYPE_MSA = "msa";
|
||||
public static final String USER_TYPE_MOJANG = "mojang";
|
||||
public static final String USER_TYPE_LEGACY = "legacy";
|
||||
|
||||
|
@ -110,7 +110,7 @@ public class MicrosoftSession {
|
||||
public AuthInfo toAuthInfo() {
|
||||
requireNonNull(profile);
|
||||
|
||||
return new AuthInfo(profile.getName(), profile.getId(), accessToken, AuthInfo.USER_TYPE_MOJANG, "{}");
|
||||
return new AuthInfo(profile.getName(), profile.getId(), accessToken, AuthInfo.USER_TYPE_MSA, "{}");
|
||||
}
|
||||
|
||||
public static class User {
|
||||
|
@ -114,7 +114,7 @@ public class OfflineAccount extends Account {
|
||||
@Override
|
||||
public AuthInfo logIn() throws AuthenticationException {
|
||||
// Using "legacy" user type here because "mojang" user type may cause "invalid session token" or "disconnected" when connecting to a game server.
|
||||
AuthInfo authInfo = new AuthInfo(username, uuid, UUIDTypeAdapter.fromUUID(UUID.randomUUID()), AuthInfo.USER_TYPE_LEGACY, "{}");
|
||||
AuthInfo authInfo = new AuthInfo(username, uuid, UUIDTypeAdapter.fromUUID(UUID.randomUUID()), AuthInfo.USER_TYPE_MSA, "{}");
|
||||
|
||||
if (loadAuthlibInjector(skin)) {
|
||||
CompletableFuture<AuthlibInjectorArtifactInfo> artifactTask = CompletableFuture.supplyAsync(() -> {
|
||||
@ -154,7 +154,7 @@ public class OfflineAccount extends Account {
|
||||
private YggdrasilServer server;
|
||||
|
||||
public OfflineAuthInfo(AuthInfo authInfo, AuthlibInjectorArtifactInfo artifact) {
|
||||
super(authInfo.getUsername(), authInfo.getUUID(), authInfo.getAccessToken(), USER_TYPE_LEGACY, authInfo.getUserProperties());
|
||||
super(authInfo.getUsername(), authInfo.getUUID(), authInfo.getAccessToken(), USER_TYPE_MSA, authInfo.getUserProperties());
|
||||
|
||||
this.artifact = artifact;
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class YggdrasilSession {
|
||||
if (selectedProfile == null)
|
||||
throw new IllegalStateException("No character is selected");
|
||||
|
||||
return new AuthInfo(selectedProfile.getName(), selectedProfile.getId(), accessToken, AuthInfo.USER_TYPE_MOJANG,
|
||||
return new AuthInfo(selectedProfile.getName(), selectedProfile.getId(), accessToken, AuthInfo.USER_TYPE_MSA,
|
||||
Optional.ofNullable(userProperties)
|
||||
.map(properties -> properties.entrySet().stream()
|
||||
.collect(Collectors.toMap(Map.Entry::getKey,
|
||||
|
Loading…
x
Reference in New Issue
Block a user