Skip to content

Commit

Permalink
Fix Meteor's in-game latest version checking
Browse files Browse the repository at this point in the history
  • Loading branch information
MineGame159 committed Jan 8, 2025
1 parent 3819e27 commit f2f1ead
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit f2f1ead

Please sign in to comment.