Jump to content

[1.8 (Does it really matter?)] Checking for available updates


LordMastodon

Recommended Posts

So I know there are mods that on startup check the internet for an updated version of the mod, and if they find one they tell the player. So basically I was wondering how they did that. I found this thing called Jenkins which lets you do internet stuff with Java plugins, but I'm not quite sure how that works either, and I don't know if that's what's being used... Thanks in advance!

Who are you? Why have you brought me here? And why are there so many PewDiePie fanboys surrounding meeeeeeeee....... *falls into pit and dies*.

 

Also this. Check it out.

width=700 height=200http://i.imgur.com/J4rrGt6.png[/img]

Link to comment
Share on other sites

What most of these mods do is just download a text file that is hosted somewhere. This file contains the latest version name, they then compare that to the installed version and display a warning if it's outdated.

You can either maintain this file manually or use a Continous Integration software, like Jenkins.

 

In the end though: Nobody really cares but the mod maker so they can say "look how fancy this is". For the end users these things are mostly annoying, because they are coded stupidly.

 

I suppose that could be annoying for something like bug-fix updates, but it could be useful for major updates. For instance, if someone is doing a YouTube playthrough of a mod, and while they're playing a massive feature comes out such as Thermal Expansion integration or something like that. They're also playing with Thermal Expansion, and it's annoying that the two mods don't integrate. You start to see where something like that might be useful. Using that system, you could probably make a "version syntax" like 1.0.0, where the third number is minor bug-fix updates, the second number is major block-adding updates and the first number is a major mod overhaul. You could do a system that notifies the player about whether the update is bug-fix, major or overhaul, and a config system that lets them configure what version notifications they want to see. However, I am all ears to what you mean by "coded stupidly" and what could be done to make that different. I'd also be grateful if you could share with me how I could make a script that downloads that file from the internet, and how I could use Jenkins to do Continuous Integration, that would be greatly appreciated as I've not used something like that as of yet.

Who are you? Why have you brought me here? And why are there so many PewDiePie fanboys surrounding meeeeeeeee....... *falls into pit and dies*.

 

Also this. Check it out.

width=700 height=200http://i.imgur.com/J4rrGt6.png[/img]

Link to comment
Share on other sites

What most of these mods do is just download a text file that is hosted somewhere. This file contains the latest version name, they then compare that to the installed version and display a warning if it's outdated.

You can either maintain this file manually or use a Continous Integration software, like Jenkins.

 

In the end though: Nobody really cares but the mod maker so they can say "look how fancy this is". For the end users these things are mostly annoying, because they are coded stupidly.

But it's annoying when you have to check for a new version every day...

Link to comment
Share on other sites

What most of these mods do is just download a text file that is hosted somewhere. This file contains the latest version name, they then compare that to the installed version and display a warning if it's outdated.

You can either maintain this file manually or use a Continous Integration software, like Jenkins.

 

In the end though: Nobody really cares but the mod maker so they can say "look how fancy this is". For the end users these things are mostly annoying, because they are coded stupidly.

But it's annoying when you have to check for a new version every day...

 

What do you mean?

Who are you? Why have you brought me here? And why are there so many PewDiePie fanboys surrounding meeeeeeeee....... *falls into pit and dies*.

 

Also this. Check it out.

width=700 height=200http://i.imgur.com/J4rrGt6.png[/img]

Link to comment
Share on other sites

you could probably make a "version syntax" like 1.0.0, where the third number is minor bug-fix updates, the second number is major block-adding updates and the first number is a major mod overhaul.

 

You've basically reinvented SemVer. While it would be amazing if all mods followed something even resembling SemVer (e.g. MCVERSION-MAJOR.MINOR.PATCH), it's never going to happen.

 

To get text from the internet is extremely easy using Apache Commons IO which is already a dependency of Minecraft/Forge:

 

String s;

InputStream in = new URL( "http://jakarta.apache.org" ).openStream();

try {
   s = IOUtils.toString(in);
} finally {
   IOUtils.closeQuietly(in);
}

 

You won't be able to use Jenkins for CI unless you already have a server. My personal suggestion if you don't is to use Drone, a fairly good, and free, CI server.

Don't make mods if you don't know Java.

Check out my website: http://shadowfacts.net

Developer of many mods

Link to comment
Share on other sites

you could probably make a "version syntax" like 1.0.0, where the third number is minor bug-fix updates, the second number is major block-adding updates and the first number is a major mod overhaul.

 

You've basically reinvented SemVer. While it would be amazing if all mods followed something even resembling SemVer (e.g. MCVERSION-MAJOR.MINOR.PATCH), it's never going to happen.

 

To get text from the internet is extremely easy using Apache Commons IO which is already a dependency of Minecraft/Forge:

 

String s;

InputStream in = new URL( "http://jakarta.apache.org" ).openStream();

try {
   s = IOUtils.toString(in);
} finally {
   IOUtils.closeQuietly(in);
}

 

You won't be able to use Jenkins for CI unless you already have a server. My personal suggestion if you don't is to use Drone, a fairly good, and free, CI server.

 

 

Thanks! Do you have any tutorials on how I could use Drone? As I said, I've never used a CI server, and I don't really know how they work. I'd also like to create an autoscript that updates the version file every build, any ideas?

Who are you? Why have you brought me here? And why are there so many PewDiePie fanboys surrounding meeeeeeeee....... *falls into pit and dies*.

 

Also this. Check it out.

width=700 height=200http://i.imgur.com/J4rrGt6.png[/img]

Link to comment
Share on other sites

To automatically output the version to a txt file, you can create a custom task like so:

 

task version() {
File f = new File("$buildDir/libs/version.txt")
if (!f.getParentFile().exists()) f.getParentFile().mkdirs()
if (!f.exists()) f.createNewFile()
FileOutputStream fos = new FileOutputStream(f)
fos.write(project.version.getBytes())
fos.close()
}

 

Drone:

 

(note, this assumes your mod is open source and hosted on GitHub)

 

1. Go to drone.io

2. Login with GitHub

3. Create a new GitHub project with your repository

4. Select Java as the project language

5. Replace the default buildscript with:

 

chmod +x gradlew
./gradlew setupCIWorkspace build version

 

6. Open the artifacts tab and to the list add:

 

build/libs/*.jar
build/libs/version.txt

 

7. Press Save

8. Build your project

9. Use the aforementioned code to download the contents of your version.txt from this url:

 

https://drone.io/github.com/{username}/{RepoName}/files/build/libs/version.txt

Don't make mods if you don't know Java.

Check out my website: http://shadowfacts.net

Developer of many mods

Link to comment
Share on other sites

Thanks, that helps a lot. Just wondering though, where do I put this task? I don't think there's any event that gets fired when the thing is built...

Who are you? Why have you brought me here? And why are there so many PewDiePie fanboys surrounding meeeeeeeee....... *falls into pit and dies*.

 

Also this. Check it out.

width=700 height=200http://i.imgur.com/J4rrGt6.png[/img]

Link to comment
Share on other sites

Not familiar with Gradle either, but I'm assuming buildscript is the task called when the thing is built, so I figure out how to implement that task you specified into the build.gradle.

Who are you? Why have you brought me here? And why are there so many PewDiePie fanboys surrounding meeeeeeeee....... *falls into pit and dies*.

 

Also this. Check it out.

width=700 height=200http://i.imgur.com/J4rrGt6.png[/img]

Link to comment
Share on other sites

build.gradle. Also, now it's telling me that

Task 'version' not found in root project 'Miscal'.

Which is intriguing, considering I told .gitignore to lift its limitations on anything gradle related and pushed, so Drone should now have both gradlew and build.gradle...

Who are you? Why have you brought me here? And why are there so many PewDiePie fanboys surrounding meeeeeeeee....... *falls into pit and dies*.

 

Also this. Check it out.

width=700 height=200http://i.imgur.com/J4rrGt6.png[/img]

Link to comment
Share on other sites

So now my Drone build is saying: Execution failed for task ':deobfMcMCP'.

> Your Access Transformers be broke! I'm not quite sure how you're supposed to fix that.

Who are you? Why have you brought me here? And why are there so many PewDiePie fanboys surrounding meeeeeeeee....... *falls into pit and dies*.

 

Also this. Check it out.

width=700 height=200http://i.imgur.com/J4rrGt6.png[/img]

Link to comment
Share on other sites

I'm not. I only have a rudimentary understanding of what those ARE. I'm pretty sure Forge uses them, but I don't. Here's the WHOLE crash report.

Who are you? Why have you brought me here? And why are there so many PewDiePie fanboys surrounding meeeeeeeee....... *falls into pit and dies*.

 

Also this. Check it out.

width=700 height=200http://i.imgur.com/J4rrGt6.png[/img]

Link to comment
Share on other sites

I'm running Windows, and Drone runs Ubuntu, so I can't exactly replicate the situation, but running

gradlew setupCIWorkspace build version

returns the same error on my computer as it does on Drone.

Who are you? Why have you brought me here? And why are there so many PewDiePie fanboys surrounding meeeeeeeee....... *falls into pit and dies*.

 

Also this. Check it out.

width=700 height=200http://i.imgur.com/J4rrGt6.png[/img]

Link to comment
Share on other sites

Alright, done. Here's the link to the bug report, tell me if that seems fine to you or whether I should change it up. Also, one question: how log does it normally take until someone responds to the bug report?

Who are you? Why have you brought me here? And why are there so many PewDiePie fanboys surrounding meeeeeeeee....... *falls into pit and dies*.

 

Also this. Check it out.

width=700 height=200http://i.imgur.com/J4rrGt6.png[/img]

Link to comment
Share on other sites

Yeah moved it to the ForgeGradle repo as per the suggestion of luacs1998 on the MinecraftForge repo. What's the t2a (time to answer) for ForgeGradle (longer I assume)?

Who are you? Why have you brought me here? And why are there so many PewDiePie fanboys surrounding meeeeeeeee....... *falls into pit and dies*.

 

Also this. Check it out.

width=700 height=200http://i.imgur.com/J4rrGt6.png[/img]

Link to comment
Share on other sites

Got it. So considerably longer ;). Also, how do you think I could convert a version string that looks like this: "1.0.0" to 3 integers that I can use to compare to the internal version numbers?

Who are you? Why have you brought me here? And why are there so many PewDiePie fanboys surrounding meeeeeeeee....... *falls into pit and dies*.

 

Also this. Check it out.

width=700 height=200http://i.imgur.com/J4rrGt6.png[/img]

Link to comment
Share on other sites

Never mind, I've found a way using String.split(). How do you think a system like this sounds:

 

First of all if there's an update available the mod tells you "There is a new update available for Miscal, version <new version number>."

 

If it's a bug-fix update, it then tells you "Please note that this is only a bug-fixing update and is not completely necessary."

If it's a content-adding update, it tells you "Please note that this is an update that adds new content, and it is recommended you update."

If it's an overhaul update it says "This is an overhaul update and it is highly recommended you update as the new version is incompatible with old ones." Overhaul updates should be extremely rare, but they're probably going to happen at some point due to the existence of Minecraft updates.

 

Finally, it says "Please visit https://drone.io/github.com/LordMastodon/Miscal/files to get the new update." So that you can get the new update.

 

How does that sound? Need some feedback.

Who are you? Why have you brought me here? And why are there so many PewDiePie fanboys surrounding meeeeeeeee....... *falls into pit and dies*.

 

Also this. Check it out.

width=700 height=200http://i.imgur.com/J4rrGt6.png[/img]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.