Skip to content

Commit

Permalink
Fixed possible crash and Replaced deprecated method
Browse files Browse the repository at this point in the history
- Fixed deprecated method in ElysiumDaysTweaks class.
- Added try-catch to avoid possible crash due to error with parsing JSON result in VersionChecking class.
  • Loading branch information
VipCoder8 committed Nov 5, 2024
1 parent 27c0342 commit 7cfed00
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ private void initCustomScreens() {
private void registerBuiltinResourcePacks() {
FabricLoader.getInstance().getModContainer("elysium-days-tweaks").ifPresent(modContainer -> {
ResourceManagerHelper.registerBuiltinResourcePack(
new Identifier("elysium-days-tweaks", "elysiumdaystweaks"),
modContainer,
"§fElysium §6Days §cTweaks",
ResourcePackActivationType.ALWAYS_ENABLED);
new Identifier("elysium-days-tweaks", "elysiumdaystweaks"),
modContainer,
Text.literal("§fElysium §6Days §cTweaks"),
ResourcePackActivationType.ALWAYS_ENABLED);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ public void checkEDVersion() {
RequestSender requestSender = new RequestSender();
String jsonString = requestSender.sendRequestTo(
Constants.Links.MODRINTH_API_LINK + "v2/project/lz3ryGPQ/version");
Strings.LATEST_ED_VERSION = JsonParser.parseString(jsonString).getAsJsonArray().get(0)
.getAsJsonObject().get("version_number").getAsString();
try {
Strings.LATEST_ED_VERSION = JsonParser.parseString(jsonString).getAsJsonArray().get(0)
.getAsJsonObject().get("version_number").getAsString();

String[] currentVersionNums = Constants.Core.CURRENT_ED_VERSION.split("\\.");
String[] latestVersionNums = Strings.LATEST_ED_VERSION.split("\\.");
String[] currentVersionNums = Constants.Core.CURRENT_ED_VERSION.split("\\.");
String[] latestVersionNums = Strings.LATEST_ED_VERSION.split("\\.");

Flags.IS_LATEST_VERSION = isVersionBigger(currentVersionNums, latestVersionNums);
Flags.IS_LATEST_VERSION = isVersionBigger(currentVersionNums, latestVersionNums);
} catch(Exception e) {e.printStackTrace();}
}
}

0 comments on commit 7cfed00

Please sign in to comment.