feat: commit local changes
This commit is contained in:
parent
cab557e439
commit
16974c03c6
|
@ -1,4 +1,5 @@
|
|||
.gradle
|
||||
.idea
|
||||
bin
|
||||
build
|
||||
src/test
|
||||
|
|
|
@ -4,7 +4,7 @@ plugins {
|
|||
}
|
||||
|
||||
group 'ley.modding'
|
||||
version '1.0'
|
||||
version '1.1.0'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
|
||||
|
@ -15,7 +15,7 @@ repositories {
|
|||
name "minecraft"
|
||||
}
|
||||
maven {
|
||||
url "https://data.tilera.xyz/maven/"
|
||||
url "https://maven.tilera.xyz/"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,2 +1,8 @@
|
|||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
rootProject.name = 'testcraftupdate'
|
||||
|
||||
|
|
|
@ -37,23 +37,28 @@ public class UpdateTweaker implements ITweaker {
|
|||
try {
|
||||
File configfile = new File(gameDir.getAbsolutePath() + "/pack.json");
|
||||
if (configfile.exists()) {
|
||||
boolean updated = false;
|
||||
Config config = Util.getConfig(configfile);
|
||||
Version version = Util.checkVersion(config);
|
||||
if (version.isLatest())
|
||||
return;
|
||||
System.out.println(version.current + " is outdated, starting update...");
|
||||
AddonscriptJSON oldAS = config.getAPI().getASFromTag(version.current);
|
||||
AddonscriptJSON newAS = config.getAPI().getASFromTag(version.latest);
|
||||
List<RelationFile> oldRel = Util.getRelations(oldAS);
|
||||
List<RelationFile> newRel = Util.getRelations(newAS);
|
||||
FileHandler handler = new FileHandler(gameDir);
|
||||
handler.removeFiles(Util.getToRemove(oldRel, newRel));
|
||||
handler.addFiles(Util.getToAdd(oldRel, newRel));
|
||||
handler.processOverrides(version.overrides, newAS, config);
|
||||
if (!version.isLatest()) {
|
||||
System.out.println(version.current + " is outdated, starting update...");
|
||||
AddonscriptJSON oldAS = config.getAPI().getASFromTag(version.current);
|
||||
AddonscriptJSON newAS = config.getAPI().getASFromTag(version.latest);
|
||||
List<RelationFile> oldRel = Util.getRelations(oldAS);
|
||||
List<RelationFile> newRel = Util.getRelations(newAS);
|
||||
FileHandler handler = new FileHandler(gameDir);
|
||||
handler.removeFiles(Util.getToRemove(oldRel, newRel));
|
||||
handler.addFiles(Util.getToAdd(oldRel, newRel));
|
||||
handler.processOverrides(version.overrides, newAS, config);
|
||||
updated = true;
|
||||
}
|
||||
config.version = version.latest;
|
||||
FileWriter writer = new FileWriter(configfile);
|
||||
config.toJson(writer);
|
||||
writer.close();
|
||||
if (updated) {
|
||||
throw new RuntimeException("Successfully updated modpack. Please restart the game.");
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
|
|
|
@ -13,7 +13,7 @@ public class Version {
|
|||
}
|
||||
|
||||
public boolean isLatest() {
|
||||
return latest.equals(current);
|
||||
return current == null || latest.equals(current);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue