New Version Checker Mod

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Strikingwolf

New Member
Jul 29, 2019
3,709
-26
1
I'm not going to auto update. Period. There'll be a GUI for downloads (the mod author has to provide a link for the update, and it's completely optional), and you'll just have to restart your client. I suppose servers could update through a command. The command could, in theory, use the same code with little modifications. But, then, ask Strikingwolf about how possible that is, I'm just working on the backend.
That is what we were talking about, no auto-update as far as without the player knowing, but somewhere where you could click to update.
 

Strikingwolf

New Member
Jul 29, 2019
3,709
-26
1
Okay, so I talked with the rest of the dev team. Please note that these decisions aren't final:
  • Update severity changes how much the update checker bugs you. Title Screen for basic, stop loading of MC with a click to advance screen for severe, and display in game (closable) for critical.
  • Choice between YAML and JSON for how to provide version data, also probably CurseForge integration if Squid lets us borrow his code.
  • Config option for modpack makers to turn off notifications before shipping the pack to their users. Please note that critical notifications still display.
  • Separate versions for display and for internal purposes. The reason for this is that different modders use different formats for versions. The display version will be the actual version, and the internal one will be a simple integer, compared against the server.
I repeat, decisions are not final, if you have any concerns please let us know.
EDIT: Probably going to have CF integration.
BTW, how does this look @Reika, does that satisfy what you as a large mod dev who has a version checker would want from one?
 

Reika

RotaryCraft Dev
FTB Mod Dev
Sep 3, 2013
5,079
5,331
550
Toronto, Canada
sites.google.com
BTW, how does this look @Reika, does that satisfy what you as a large mod dev who has a version checker would want from one?
This is mostly good, but it still needs to address the pack abandonment issue. Also, as for the pause launch or ingame displays, is that per launch or per update?


Also, what of my version system, which is not a simple number?
 

trajing

New Member
Jul 29, 2019
3,091
-14
1
This is mostly good, but it still needs to address the pack abandonment issue. Also, as for the pause launch or ingame displays, is that per launch or per update?


Also, what of my version system, which is not a simple number?
The display version will be the "actual" version. It'll be what the user sees. The technical version is just an int, compared against the file in a server. Bigger means more up to date. Actually, the reason we chose this system was because it seems like everyone uses a different versioning scheme and we didn't want to have to write in a custom handler (or force the dev to do it on their end) or make everyone switch to the same versioning scheme to use the mod.
 

Reika

RotaryCraft Dev
FTB Mod Dev
Sep 3, 2013
5,079
5,331
550
Toronto, Canada
sites.google.com
The display version will be the "actual" version. It'll be what the user sees. The technical version is just an int, compared against the file in a server. Bigger means more up to date. Actually, the reason we chose this system was because it seems like everyone uses a different versioning scheme and we didn't want to have to write in a custom handler (or force the dev to do it on their end) or make everyone switch to the same versioning scheme to use the mod.
OK, but how to convert?
 

trajing

New Member
Jul 29, 2019
3,091
-14
1
OK, but how to convert?
It's never used outside of the mod, so you could just call the first version you implement it "1" and then increase it by one every time you update. Or you could call it "42500" and increase it by 237 every time you update. It doesn't matter, as long as bigger means more recently released and it's an integer.
 

trajing

New Member
Jul 29, 2019
3,091
-14
1
Squid, I am following a trail of breadcrumbs on Github to attempt to figure out exactly what you're doing to find the most up-to-date mod version on CurseForge, and if that's going to error if a different dev uses a different method than you for something.
I am impressed.
 

Reika

RotaryCraft Dev
FTB Mod Dev
Sep 3, 2013
5,079
5,331
550
Toronto, Canada
sites.google.com
It's never used outside of the mod, so you could just call the first version you implement it "1" and then increase it by one every time you update. Or you could call it "42500" and increase it by 237 every time you update. It doesn't matter, as long as bigger means more recently released and it's an integer.
How? I cannot possibly need to change something every time I update. That said, mod.majorVersion*1000+(int)mod.minorVersion might work. :p
 

trajing

New Member
Jul 29, 2019
3,091
-14
1
How? I cannot possibly need to change something every time I update. That said, mod.majorVersion*1000+(int)mod.minorVersion might work. :p
Yes, that should work, unless I'm misunderstanding the code. The issue is that you'll need to update a (JSON or YAML) file to have the mod work. As soon as we get the JSON and YAML stuff done on the mod, I'm going to make a very ugly but still usable webapp for simple hosting of JSON files (for when you don't want to use CurseForge).
I'm just sad because it means I have to use PHP. :p
 

Strikingwolf

New Member
Jul 29, 2019
3,709
-26
1
Yes, that should work, unless I'm misunderstanding the code. The issue is that you'll need to update a (JSON or YAML) file to have the mod work. As soon as we get the JSON and YAML stuff done on the mod, I'm going to make a very ugly but still usable webapp for simple hosting of JSON files (for when you don't want to use CurseForge).
I'm just sad because it means I have to use PHP. :p
You can do server-side Python...
 

Strikingwolf

New Member
Jul 29, 2019
3,709
-26
1
BTW I pushed a large thing for the github. Theoretically that should get everything in the to-be updated list that is an IUpdateable and then we can work from there. The CF integration isn't in yet obviously.
 

Strikingwolf

New Member
Jul 29, 2019
3,709
-26
1
Something like this should work:
Code:
public void check(VersionContainer mod, int currentVersion) {
   try {
     URL updateUrl = new URL("http://minecraft.curseforge.com/mc-mods/" + mod.getCurseId() + "-" + mod.getName() + "/files");
     BufferedReader r = new BufferedReader(new InputStreamReader(updateUrl.openStream()));
     while (true) {
       String line = r.readLine();
       if (line == null) {
         break;
       }
       if (line.contains(".jar</a>")) {
         String remoteVersion = Integer.parseInt(line.split(mod.getName() + "-")[1].replace(".jar</a>", ""));
         int asInt = Integer.parseInt(remoteVersion);
         if (asInt > currentVersion) {
           mod.markAsOutdated(remoteVersion);
         }
       }
     }
   } catch (IOException e) {
     e.printStackTrace();
   }
}
I rewrote it instead of tracing down every single method in WebUtils.

PS: I haven't tested this.
There is one problem with this. It gets the display version, but not a technical version. Although I don't really know if you could get a display version...
 

Reika

RotaryCraft Dev
FTB Mod Dev
Sep 3, 2013
5,079
5,331
550
Toronto, Canada
sites.google.com
Yes, that should work, unless I'm misunderstanding the code. The issue is that you'll need to update a (JSON or YAML) file to have the mod work. As soon as we get the JSON and YAML stuff done on the mod, I'm going to make a very ugly but still usable webapp for simple hosting of JSON files (for when you don't want to use CurseForge).
I'm just sad because it means I have to use PHP. :p
...Crap.
 

trajing

New Member
Jul 29, 2019
3,091
-14
1
I'm going to end up writing a script for it. I just need the mod side done first, which will be partly my job and mostly Striking's. I honestly prefer not to deal with the Minecraft end too much.