diff --git a/.idea/artifacts/Launcher.xml b/.idea/artifacts/Launcher.xml index e5fae0e..4aa8fca 100644 --- a/.idea/artifacts/Launcher.xml +++ b/.idea/artifacts/Launcher.xml @@ -8,6 +8,7 @@ + \ No newline at end of file diff --git a/.idea/libraries/jsr305_3_0_2.xml b/.idea/libraries/jsr305_3_0_2.xml new file mode 100644 index 0000000..e4637c4 --- /dev/null +++ b/.idea/libraries/jsr305_3_0_2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/Launcher/Launcher.iml b/Launcher/Launcher.iml index e32da62..166a81d 100644 --- a/Launcher/Launcher.iml +++ b/Launcher/Launcher.iml @@ -38,5 +38,6 @@ + \ No newline at end of file diff --git a/Launcher/source-authlib/exceptions/AuthenticationException.java b/Launcher/source-authlib/exceptions/AuthenticationException.java new file mode 100644 index 0000000..59aa19a --- /dev/null +++ b/Launcher/source-authlib/exceptions/AuthenticationException.java @@ -0,0 +1,18 @@ +package com.mojang.authlib.exceptions; + +public class AuthenticationException extends Exception { + public AuthenticationException() { + } + + public AuthenticationException(final String message) { + super(message); + } + + public AuthenticationException(final String message, final Throwable cause) { + super(message, cause); + } + + public AuthenticationException(final Throwable cause) { + super(cause); + } +} diff --git a/Launcher/source-authlib/exceptions/AuthenticationUnavailableException.java b/Launcher/source-authlib/exceptions/AuthenticationUnavailableException.java new file mode 100644 index 0000000..a245faa --- /dev/null +++ b/Launcher/source-authlib/exceptions/AuthenticationUnavailableException.java @@ -0,0 +1,18 @@ +package com.mojang.authlib.exceptions; + +public class AuthenticationUnavailableException extends AuthenticationException { + public AuthenticationUnavailableException() { + } + + public AuthenticationUnavailableException(final String message) { + super(message); + } + + public AuthenticationUnavailableException(final String message, final Throwable cause) { + super(message, cause); + } + + public AuthenticationUnavailableException(final Throwable cause) { + super(cause); + } +} diff --git a/Launcher/source-authlib/exceptions/InsufficientPrivilegesException.java b/Launcher/source-authlib/exceptions/InsufficientPrivilegesException.java index 30eb4ec..9f80a17 100644 --- a/Launcher/source-authlib/exceptions/InsufficientPrivilegesException.java +++ b/Launcher/source-authlib/exceptions/InsufficientPrivilegesException.java @@ -1,15 +1,18 @@ package com.mojang.authlib.exceptions; public class InsufficientPrivilegesException extends AuthenticationException { + public InsufficientPrivilegesException() { + } - public InsufficientPrivilegesException() {} - public InsufficientPrivilegesException(String message) { + public InsufficientPrivilegesException(final String message) { super(message); } - public InsufficientPrivilegesException(String message, Throwable cause) { + + public InsufficientPrivilegesException(final String message, final Throwable cause) { super(message, cause); } - public InsufficientPrivilegesException(Throwable cause) { + + public InsufficientPrivilegesException(final Throwable cause) { super(cause); } } diff --git a/Launcher/source-authlib/exceptions/InvalidCredentialsException.java b/Launcher/source-authlib/exceptions/InvalidCredentialsException.java new file mode 100644 index 0000000..5430118 --- /dev/null +++ b/Launcher/source-authlib/exceptions/InvalidCredentialsException.java @@ -0,0 +1,18 @@ +package com.mojang.authlib.exceptions; + +public class InvalidCredentialsException extends AuthenticationException { + public InvalidCredentialsException() { + } + + public InvalidCredentialsException(final String message) { + super(message); + } + + public InvalidCredentialsException(final String message, final Throwable cause) { + super(message, cause); + } + + public InvalidCredentialsException(final Throwable cause) { + super(cause); + } +} diff --git a/Launcher/source-authlib/exceptions/MinecraftClientException.java b/Launcher/source-authlib/exceptions/MinecraftClientException.java new file mode 100644 index 0000000..db632e0 --- /dev/null +++ b/Launcher/source-authlib/exceptions/MinecraftClientException.java @@ -0,0 +1,30 @@ +package com.mojang.authlib.exceptions; + +public class MinecraftClientException extends RuntimeException { + + public enum ErrorType { + SERVICE_UNAVAILABLE, + HTTP_ERROR, + JSON_ERROR + } + + protected final ErrorType type; + + protected MinecraftClientException(final ErrorType type, final String message) { + super(message); + this.type = type; + } + + public MinecraftClientException(final ErrorType type, final String message, final Throwable cause) { + super(message, cause); + this.type = type; + } + + public ErrorType getType() { + return type; + } + + public AuthenticationException toAuthenticationException() { + return new AuthenticationException(this); + } +} diff --git a/Launcher/source-authlib/exceptions/UserMigratedException.java b/Launcher/source-authlib/exceptions/UserMigratedException.java index 018aa2b..6c5e869 100644 --- a/Launcher/source-authlib/exceptions/UserMigratedException.java +++ b/Launcher/source-authlib/exceptions/UserMigratedException.java @@ -1,8 +1,18 @@ package com.mojang.authlib.exceptions; public class UserMigratedException extends InvalidCredentialsException { - public UserMigratedException() {} - public UserMigratedException(String message) {super(message);} - public UserMigratedException(String message, Throwable cause) { super(message, cause); } - public UserMigratedException(Throwable cause) { super(cause);} -} \ No newline at end of file + public UserMigratedException() { + } + + public UserMigratedException(final String message) { + super(message); + } + + public UserMigratedException(final String message, final Throwable cause) { + super(message, cause); + } + + public UserMigratedException(final Throwable cause) { + super(cause); + } +} diff --git a/Launcher/source-authlib/yggdrasil/YggdrasilAuthenticationService.java b/Launcher/source-authlib/yggdrasil/YggdrasilAuthenticationService.java index e297527..13459f9 100644 --- a/Launcher/source-authlib/yggdrasil/YggdrasilAuthenticationService.java +++ b/Launcher/source-authlib/yggdrasil/YggdrasilAuthenticationService.java @@ -3,6 +3,7 @@ import com.mojang.authlib.*; import com.mojang.authlib.exceptions.AuthenticationException; import com.mojang.authlib.minecraft.MinecraftSessionService; +import com.mojang.authlib.minecraft.UserApiService; import launcher.helper.LogHelper; import java.net.Proxy; @@ -10,6 +11,8 @@ public class YggdrasilAuthenticationService implements AuthenticationService { private final Environment environment; + private Proxy proxy; + public YggdrasilAuthenticationService(final Proxy proxy) { this(proxy, determineEnvironment()); } @@ -24,11 +27,12 @@ public YggdrasilAuthenticationService(final Proxy proxy, final String clientToken, final Environment environment) { this.environment = environment; - LogHelper.debug("Patched AuthenticationService created: '%s'", new Object[] { clientToken }); + this.proxy = proxy; + LogHelper.debug("Patched AuthenticationService created: '%s'", clientToken); } private static Environment determineEnvironment() { - return EnvironmentParser.getEnvironmentFromProperties().orElse(YggdrasilEnvironment.PROD); + return EnvironmentParser.getEnvironmentFromProperties().orElse(YggdrasilEnvironment.PROD.getEnvironment()); } public UserAuthentication createUserAuthentication(final Agent agent) { @@ -44,6 +48,10 @@ } public YggdrasilSocialInteractionsService createSocialInteractionsService(final String accessToken) throws AuthenticationException { - return new YggdrasilSocialInteractionsService(this, accessToken, this.environment); + return (YggdrasilSocialInteractionsService)new YggdrasilSocialInteractionsService(this, accessToken, this.environment); + } + + public UserApiService createUserApiService(final String accessToken) throws AuthenticationException { + return (UserApiService)new YggdrasilUserApiService(accessToken, proxy, environment); } } diff --git a/Launcher/source-authlib/yggdrasil/YggdrasilUserApiService.java b/Launcher/source-authlib/yggdrasil/YggdrasilUserApiService.java new file mode 100644 index 0000000..77dc7c0 --- /dev/null +++ b/Launcher/source-authlib/yggdrasil/YggdrasilUserApiService.java @@ -0,0 +1,83 @@ +package com.mojang.authlib.yggdrasil; + +import com.google.common.collect.ImmutableSet; +import com.mojang.authlib.Environment; +import com.mojang.authlib.HttpAuthenticationService; +import com.mojang.authlib.exceptions.AuthenticationException; +import com.mojang.authlib.minecraft.TelemetrySession; +import com.mojang.authlib.minecraft.UserApiService; +import com.mojang.authlib.minecraft.client.MinecraftClient; +import com.mojang.authlib.yggdrasil.response.BlockListResponse; +import com.mojang.authlib.yggdrasil.response.UserAttributesResponse; + +import javax.annotation.Nullable; +import java.net.Proxy; +import java.net.URL; +import java.time.Instant; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.Executor; + +public class YggdrasilUserApiService implements UserApiService { + private static final long BLOCKLIST_REQUEST_COOLDOWN_SECONDS = 120; + private static final UUID ZERO_UUID = new UUID(0, 0); + +// private final URL routePrivileges; +// private final URL routeBlocklist; +// +// private final MinecraftClient minecraftClient; +// private final Environment environment; + private UserProperties properties = OFFLINE_PROPERTIES; + + @Nullable + private Instant nextAcceptableBlockRequest; + + @Nullable + private Set blockList; + + public YggdrasilUserApiService(final String accessToken, final Proxy proxy, final Environment env) throws AuthenticationException { + // Заглушка + } + + @Override + public UserProperties properties() { + return properties; + } + + @Override + public TelemetrySession newTelemetrySession(final Executor executor) { + return TelemetrySession.DISABLED; + } + + @Override + public boolean isBlockedPlayer(final UUID playerID) { + return false; + } + + @Override + public void refreshBlockList() {} + + @Nullable + private Set fetchBlockList() { + return null; + } + + private boolean canMakeBlockListRequest() { + return nextAcceptableBlockRequest == null || Instant.now().isAfter(nextAcceptableBlockRequest); + } + + @Nullable + private Set forceFetchBlockList() { + return null; + } + + private void fetchProperties() throws AuthenticationException { + // Заглушка + } + + private static void addFlagIfUserHasPrivilege(final boolean privilege, final UserFlag value, final ImmutableSet.Builder output) { + if (privilege) { + output.add(value); + } + } +} diff --git a/build/libraries/input/jsr305-3.0.2.jar b/build/libraries/input/jsr305-3.0.2.jar new file mode 100644 index 0000000..59222d9 --- /dev/null +++ b/build/libraries/input/jsr305-3.0.2.jar Binary files differ diff --git a/buildnumber b/buildnumber index da284d5..19b4d5e 100644 --- a/buildnumber +++ b/buildnumber @@ -1 +1 @@ -573, 14.11.2021 \ No newline at end of file +583, 08.01.2022 \ No newline at end of file diff --git a/compat/authlib/GameProfile.class b/compat/authlib/GameProfile.class new file mode 100644 index 0000000..27b6e03 --- /dev/null +++ b/compat/authlib/GameProfile.class Binary files differ diff --git a/compat/authlib/authlib-clean-old.jar b/compat/authlib/authlib-clean-old.jar new file mode 100644 index 0000000..75b527e --- /dev/null +++ b/compat/authlib/authlib-clean-old.jar Binary files differ diff --git a/compat/authlib/authlib-clean.jar b/compat/authlib/authlib-clean.jar index 75b527e..0b32f3f 100644 --- a/compat/authlib/authlib-clean.jar +++ b/compat/authlib/authlib-clean.jar Binary files differ