diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/TitleScreenMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/TitleScreenMixin.java index be16958768..fe4a104656 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/TitleScreenMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/TitleScreenMixin.java @@ -5,11 +5,11 @@ package meteordevelopment.meteorclient.mixin; +import com.google.gson.JsonElement; import com.google.gson.JsonParser; import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.systems.config.Config; import meteordevelopment.meteorclient.utils.Utils; -import meteordevelopment.meteorclient.utils.misc.Version; import meteordevelopment.meteorclient.utils.network.Http; import meteordevelopment.meteorclient.utils.network.MeteorExecutor; import meteordevelopment.meteorclient.utils.player.TitleScreenCredits; @@ -47,20 +47,25 @@ private void onRenderIdkDude(DrawContext context, int mouseX, int mouseY, float .sendString(); if (res == null) return; - Version latestVer = new Version(JsonParser.parseString(res).getAsJsonObject().get("version").getAsString()); + JsonElement latestBuild = JsonParser.parseString(res).getAsJsonObject() + .getAsJsonObject("builds") + .get(MeteorClient.VERSION.toString()); - if (latestVer.isHigherThan(MeteorClient.VERSION)) { + if (latestBuild == null) + return; + + if (latestBuild.getAsInt() > Integer.parseInt(MeteorClient.BUILD_NUMBER)) { YesNoPrompt.create() .title("New Update") .message("A new version of Meteor has been released.") - .message("Your version: %s", MeteorClient.VERSION) - .message("Latest version: %s", latestVer) + .message("Your version: %s", MeteorClient.VERSION + "-" + MeteorClient.BUILD_NUMBER) + .message("Latest version: %s", MeteorClient.VERSION + "-" + latestBuild.getAsInt()) .message("Do you want to update?") .onYes(() -> Util.getOperatingSystem().open("https://meteorclient.com/")) .onNo(() -> OkPrompt.create() .title("Are you sure?") .message("Using old versions of Meteor is not recommended") - .message("and could report in issues.") + .message("and could result in issues.") .id("new-update-no") .onOk(this::close) .show())