Fix chat is broken on Minecraft 1.20
This commit is contained in:
@@ -30,6 +30,7 @@ import java.util.UUID;
|
|||||||
*/
|
*/
|
||||||
@Immutable
|
@Immutable
|
||||||
public class AuthInfo implements AutoCloseable {
|
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_MOJANG = "mojang";
|
||||||
public static final String USER_TYPE_LEGACY = "legacy";
|
public static final String USER_TYPE_LEGACY = "legacy";
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ public class MicrosoftSession {
|
|||||||
public AuthInfo toAuthInfo() {
|
public AuthInfo toAuthInfo() {
|
||||||
requireNonNull(profile);
|
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 {
|
public static class User {
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ public class OfflineAccount extends Account {
|
|||||||
@Override
|
@Override
|
||||||
public AuthInfo logIn() throws AuthenticationException {
|
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.
|
// 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)) {
|
if (loadAuthlibInjector(skin)) {
|
||||||
CompletableFuture<AuthlibInjectorArtifactInfo> artifactTask = CompletableFuture.supplyAsync(() -> {
|
CompletableFuture<AuthlibInjectorArtifactInfo> artifactTask = CompletableFuture.supplyAsync(() -> {
|
||||||
@@ -154,7 +154,7 @@ public class OfflineAccount extends Account {
|
|||||||
private YggdrasilServer server;
|
private YggdrasilServer server;
|
||||||
|
|
||||||
public OfflineAuthInfo(AuthInfo authInfo, AuthlibInjectorArtifactInfo artifact) {
|
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;
|
this.artifact = artifact;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public class YggdrasilSession {
|
|||||||
if (selectedProfile == null)
|
if (selectedProfile == null)
|
||||||
throw new IllegalStateException("No character is selected");
|
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)
|
Optional.ofNullable(userProperties)
|
||||||
.map(properties -> properties.entrySet().stream()
|
.map(properties -> properties.entrySet().stream()
|
||||||
.collect(Collectors.toMap(Map.Entry::getKey,
|
.collect(Collectors.toMap(Map.Entry::getKey,
|
||||||
|
|||||||
Reference in New Issue
Block a user