Skip to content

Commit

Permalink
fix: fix JsonParser static methods not exist before 1.18
Browse files Browse the repository at this point in the history
  • Loading branch information
ybw0014 committed Sep 8, 2024
1 parent 8489904 commit ba09cfd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@

import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.JsonParser;

import io.github.bakedlibs.dough.common.CommonPatterns;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.utils.JsonUtils;

/**
* This Class represents a Metrics Service that sends data to https://bstats.org/
Expand Down Expand Up @@ -204,7 +204,7 @@ private int getLatestVersion() {
return -1;
}

JsonElement element = JsonParser.parseString(response.body());
JsonElement element = JsonUtils.parseString(response.body());

return element.getAsJsonObject().get("tag_name").getAsInt();
} catch (IOException | InterruptedException | JsonParseException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.google.gson.JsonParser;

import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.utils.JsonUtils;

/**
* The {@link GitHubConnector} is used to connect to the GitHub API service.
Expand Down Expand Up @@ -120,7 +121,7 @@ void download() {
HttpRequest.newBuilder(uri).header("User-Agent", USER_AGENT).build(),
HttpResponse.BodyHandlers.ofString()
);
JsonElement element = JsonParser.parseString(response.body());
JsonElement element = JsonUtils.parseString(response.body());

if (response.statusCode() >= 200 && response.statusCode() < 300) {
onSuccess(element);
Expand Down

0 comments on commit ba09cfd

Please sign in to comment.