Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Commit

Permalink
Fix support for Microsoft accounts (fixes #16)
Browse files Browse the repository at this point in the history
  • Loading branch information
comp500 committed Mar 5, 2021
1 parent 52add0e commit d71b85a
Showing 1 changed file with 1 addition and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import link.infra.jumploader.resolution.ResolvableJar;
import link.infra.jumploader.resolution.download.PreDownloadCheck;
import link.infra.jumploader.resolution.download.verification.SHA1HashingInputStream;
import link.infra.jumploader.util.RequestUtils;
import link.infra.jumploader.util.Side;
Expand Down Expand Up @@ -184,20 +183,7 @@ public MetadataResolutionResult resolve(MetadataCacheHelper.MetadataCacheView ca
jars.add(new ResolvableJar(meta.gameJar.source,
ctx.getEnvironment().jarStorage.getGameJar(meta.gameJar.version, meta.gameJar.side),
SHA1HashingInputStream.verifier(meta.gameJar.hash, meta.gameJar.source.toString()),
() -> {
if (side == Side.CLIENT) {
try {
JsonObject req = new JsonObject();
req.addProperty("accessToken", ctx.getArguments().accessToken);
int resCode = RequestUtils.postJsonForResCode(new URL("https://authserver.mojang.com/validate"), req);
if (resCode != 204 && resCode != 200) {
throw new PreDownloadCheck.PreDownloadCheckException("Authentication token is invalid, please go online to download the Minecraft JAR!");
}
} catch (IOException e) {
throw new PreDownloadCheck.PreDownloadCheckException("Failed to check authentication, please go online to download the Minecraft JAR!", e);
}
}
}, "Minecraft " + side + " " + gameVersion));
"Minecraft " + side + " " + gameVersion));
// The server JAR bundles all it's dependencies
if (side == Side.CLIENT) {
for (MinecraftLibraryJar libraryJar : meta.libs) {
Expand Down

0 comments on commit d71b85a

Please sign in to comment.