fix running in versions without version.json
All checks were successful
Publish to snapshot maven / build (push) Successful in 23s
All checks were successful
Publish to snapshot maven / build (push) Successful in 23s
This commit is contained in:
parent
acc021ffa0
commit
85c94881cf
|
@ -36,8 +36,6 @@ dependencies {
|
||||||
api(libs.annotations)
|
api(libs.annotations)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.VERSION_21
|
sourceCompatibility = JavaVersion.VERSION_21
|
||||||
targetCompatibility = JavaVersion.VERSION_21
|
targetCompatibility = JavaVersion.VERSION_21
|
||||||
|
|
|
@ -175,7 +175,11 @@ public class Minecraft implements FrogPlugin {
|
||||||
if (Files.exists(fs.getPath(n)) && n.contains(FrogLoaderImpl.getInstance().getEnv().getIdentifier())) {
|
if (Files.exists(fs.getPath(n)) && n.contains(FrogLoaderImpl.getInstance().getEnv().getIdentifier())) {
|
||||||
LOGGER.info("Found game: {}", jar);
|
LOGGER.info("Found game: {}", jar);
|
||||||
foundMainClass = n.substring(0, n.length() - 6).replace("/", ".");
|
foundMainClass = n.substring(0, n.length() - 6).replace("/", ".");
|
||||||
version = FrogLoaderImpl.getInstance().getGson().fromJson(Files.readString(fs.getPath("version.json")), JsonObject.class).get("id").getAsString();
|
try {
|
||||||
|
version = FrogLoaderImpl.getInstance().getGson().fromJson(Files.readString(fs.getPath("version.json")), JsonObject.class).get("id").getAsString();
|
||||||
|
} catch (Exception e){
|
||||||
|
version = FrogLoaderImpl.getInstance().getArgument("version");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue